-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve sdk #18
Merged
Merged
Improve sdk #18
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Closed
34 tasks
corbadoman
commented
Dec 17, 2023
corbadoman
commented
Dec 17, 2023
corbadoman
commented
Dec 17, 2023
corbadoman
commented
Dec 17, 2023
corbadoman
commented
Dec 17, 2023
corbadoman
commented
Dec 18, 2023
corbadoman
commented
Jan 2, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
corbadoman
commented
Jan 18, 2024
…hToken.test.ts 🐛 fix(emailLink.test.ts): remove unnecessary import of axios from emailLink.test.ts 🐛 fix(emailOtp.test.ts): remove unnecessary import of axios from emailOtp.test.ts 🐛 fix(smsOtp.test.ts): remove unnecessary import of axios from smsOtp.test.ts 🐛 fix(user.test.ts): remove unnecessary import of axios from user.test.ts 🐛 fix(utils.ts): add missing import of AxiosMockAdapter in utils.ts ✨ feat(utils.ts): add utility functions MockAxiosInstance and restoreMock to simplify mocking axios in tests
🐛 fix(assert.ts): add validation for URL in the assert class to ensure it is valid and meets certain criteria
… instead of relying on environment variable for consistency and reliability ✨ feat(config.ts): add methods setFrontendAPI and setBackendAPI to allow dynamic configuration of frontend and backend APIs
…uppercase PORT to improve semantics ✨ feat(server.ts): add support for process.env.PORT environment variable to be able to run app on a configurable port 📦 deps(package.json): add memory-cache-node package as a dependency 🔧 chore(config.ts): import MemoryCache from memory-cache-node and axios from axios 🔧 chore(config.ts): add JWKSCache property to ConfigInterface and set it to DefaultJwksCache 🔧 chore(config.ts): add DefaultClient property to ConfigInterface and set it to DefaultClient 🔧 chore(config.ts): add setHttpClient method to Config class to set the http client 🔧 chore(config.ts): add setJwksCache method to Config class to set the JWKS cache 🔧 chore(config.ts): add setShortSessionCookieName method to Config class to set the short session cookie name 🔧 chore(index.ts): remove export of DefaultBackendAPI, DefaultFrontendAPI, DefaultShortSessionCookieName, and DefaultCacheMaxAge 🔧 chore(index.ts): remove import of DefaultBackendAPI, DefaultFrontendAPI, DefaultShortSessionCookieName, and DefaultCacheMaxAge 🔧 chore(index.ts): remove export of DefaultBackendAPI, DefaultFrontendAPI, DefaultShortSessionCookieName, and DefaultCacheMaxAge 🔧 chore(index.ts): remove import of DefaultBackendAPI, DefaultFrontendAPI, DefaultShortSessionCookieName, and DefaultCacheMaxAge 🔧 chore(sdk.ts): add jwksCache parameter to Session constructor and assign it to this.JWKSCache 🔧 chore(sdk.ts): add axiosClient parameter to Session constructor and assign it to this.Client 🔧 chore(sessionService.ts): add client parameter to Session constructor and assign it to this.client 🔧 chore(sessionService.ts): add jwksCache parameter to Session constructor and assign it to this.jwksCache 🔧 chore(sessionService.ts): add cacheMaxAge parameter to Session constructor and assign it to this.cacheMaxAge 🔧 chore(sessionService.ts): add jwksCache property to Session class and assign it to DefaultJwksCache 🔧 chore(sessionService.ts): add cacheMaxAge property to Session class and assign it to DefaultCacheMaxAge 🔧 chore(session
… the correct SDK usage and services 🔧 chore(sdk.ts): rename emailOtp() method to emailOtps() for consistency with other service methods 🔧 chore(emailOtp.test.ts): update method calls from sdk.emailOtp() to sdk.emailOtps() 🔧 chore(smsOtp.test.ts): update method calls from sdk.smsOtp() to sdk.smsOtps() 🔧 chore(config.test.ts): add unit tests for the Config class to ensure proper instantiation and default values 🔧 chore(sdk.test.ts): add unit tests for the SDK class to ensure proper instantiation and creation of service objects
corbadoman
force-pushed
the
17-improve-sdk
branch
from
January 18, 2024 20:03
b164682
to
ed65d99
Compare
…face and related methods 🔒 chore(sessionService.ts): change validateShortSessionValue and getCurrentUser methods to accept token as a string parameter instead of RequestWithCookies object
…o optimize package size and improve maintainability 🔧 chore(config.ts): remove unused import of 'memory-cache-node' to improve code readability and maintainability 🔧 chore(sdk.ts): update jwks URI concatenation to use template literals for better code readability 🔧 chore(sessionService.ts): remove unused import of 'memory-cache-node' to improve code readability and maintainability 🔧 chore(config.test.ts): remove unused import of 'DefaultJwksCache' to improve code readability and maintainability 🔧 chore(session.test.ts): remove unused import of 'MemoryCache' to improve code readability and maintainability
…ile extension to avoid potential import errors
…o ensure correct instantiation and default values 🔧 chore(sdk.test.ts): add unit tests for the SDK class to ensure correct instantiation and creation of various objects 🔧 chore(user.test.ts): remove unit tests for the User entity as they are no longer needed 🔧 chore(authToken.test.ts): remove unit tests for the AuthToken service as they are no longer needed 🔧 chore(emailLink.test.ts): remove unit tests for the EmailLink service as they are no longer needed 🔧 chore(emailOtp.test.ts): remove unit tests for the EmailOTP service as they are no longer needed 🔧 chore(session.test.ts): remove unit tests for the Session service as they are no longer needed 🔧 chore(smsOtp.test.ts): remove unit tests for the SmsOTP service as they are no longer needed 🔧 chore(user.test.ts): remove unit tests for the User service as they are no longer needed
…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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.