Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat(sessionExample.ts): add example code for handling session cook…
…ies and authentication This commit adds a new file `sessionExample.ts` which contains example code for handling session cookies and authentication in an Express.js application. The code sets up an Express server, configures cookie parsing, and initializes the Corbado SDK with the necessary credentials. The code includes three routes: - The root route ("/") simply returns a "Hello world!" message. - The "/setCookie" route sets a short session cookie with a predefined value. The cookie is set with a maximum age of 15 minutes and is marked as HTTP-only. - The "/logged-in" route demonstrates how to handle authentication using the Corbado SDK. It retrieves the short session cookie from the request, verifies the user's authentication status, and displays user information if authenticated. If the user is not authenticated, it redirects to a login page. The server is set to listen on port 8080. This code serves as an example for developers who want to implement session cookies and authentication using the Corbado SDK in their Express.js applications.
- Loading branch information