Auto Refresh Token#5535
Conversation
- Added middleware to handle access and refresh token management, including extraction from cookies and token expiration checks. - Introduced GraphQL mutation for refreshing tokens and updated cookie handling for user settings. - Refactored cookie utility functions to support new token management strategy. - Updated various components to utilize new token handling methods, ensuring proper authentication flow. - Enhanced user experience by automatically refreshing tokens and managing session state effectively.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
E2E Test Report: ❌ FAILEDBranch: Deployed with Cloudflare Pages at 2025-06-23T16:16:15.952Z |
…d user metadata cookies
E2E Test Report: ❌ FAILEDBranch: View Branch-specific E2E Report Deployed with Cloudflare Pages at 2025-06-24T10:42:04.281Z |
…g unnecessary date calculations
E2E Test Report: ❌ FAILEDBranch: View Branch-specific E2E Report Deployed with Cloudflare Pages at 2025-06-24T10:59:57.432Z |
There was a problem hiding this comment.
Bug: Null Assertion Error in Token Expiration Handling
The middleware uses non-null assertion operators on accessTokenExpiration and refreshTokenExpiration, which are the results of getTokenExpiration(). Since getTokenExpiration() can return null for malformed or invalid JWTs, using these null values with new Date() or .toString() will cause runtime errors when setting cookie expiration dates, potentially crashing the middleware.
src/middleware.ts#L129-L144
Lines 129 to 144 in fa06df2
Was this report helpful? Give feedback by reacting with 👍 or 👎
E2E Test Report: ❌ FAILEDBranch: View Branch-specific E2E Report Deployed with Cloudflare Pages at 2025-06-24T11:15:34.271Z |
E2E Test Report: ✅ PASSEDBranch: View Branch-specific E2E Report Deployed with Cloudflare Pages at 2025-06-25T00:50:14.368Z |
<TokenExpirationChecker>and Next.js Middleware to check and refresh tokens;Note: There is currently no error handler for the refresh token in Apollo GraphQL, as we expect the existing auto-refresh mechanism to cover all edge cases.