Conversation
…nd enhance error handling This commit removes unnecessary production logging from the authentication middleware and simplifies the getSession function by eliminating the forceRefresh parameter. It also introduces a clearAllSessionCache function for better cache management during tests. Additionally, the middleware now consistently retrieves user sessions without redundant logging, improving overall performance and maintainability of the authentication flow.
…hing This commit updates the authentication middleware to include the new AuthFetchUserAttributesServer function, allowing for the retrieval of user attributes alongside the current user session. The getSession function is modified to utilize these attributes for improved session management, ensuring that user-specific data such as plan and nickname are accurately reflected. Additionally, tests are updated to validate the integration of user attributes, enhancing the overall reliability and clarity of the authentication process.
…management This commit introduces a new user authentication cache invalidation feature in the Polar webhook processing logic, ensuring that user data is up-to-date immediately after subscription events. Additionally, a separate cache for user attributes is added with a shorter TTL to improve the efficiency of critical data retrieval. The getSession function is updated to prioritize fetching user attributes from the cache, reducing unnecessary calls to the server. Tests are also updated to reflect these changes, ensuring robust session management and cache handling.
This file contains hidden or 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
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.
…nd enhance error handling
This commit removes unnecessary production logging from the authentication middleware and simplifies the getSession function by eliminating the forceRefresh parameter. It also introduces a clearAllSessionCache function for better cache management during tests. Additionally, the middleware now consistently retrieves user sessions without redundant logging, improving overall performance and maintainability of the authentication flow.