-
Notifications
You must be signed in to change notification settings - Fork 93
✨(frontend) store and retrieve user token in sessionStorage #2724
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements token storage and retrieval functionality for the Keycloak authentication backend by adding an accessToken() method and storing the token in sessionStorage during user profile loading. However, there are critical issues with the token type being used.
Changes:
- Added
accessToken()method to retrieve token from sessionStorage - Token is now stored in sessionStorage when user profile is loaded
- Added
access_tokenfield to the user object returned byme()
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| src/frontend/js/api/auth/keycloak.ts | Implements token storage/retrieval using sessionStorage and adds accessToken method |
| src/frontend/js/api/auth/keycloak.spec.ts | Adds test coverage for the new accessToken method and verifies token storage behavior |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
48f1dbb to
7eb2201
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/frontend/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationSingular.tsx
Show resolved
Hide resolved
2747050 to
f8e61a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/frontend/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationSingular.tsx
Show resolved
Hide resolved
src/frontend/js/components/SaleTunnel/SaleTunnelInformation/SaleTunnelInformationSingular.tsx
Show resolved
Hide resolved
Ensure the user's token is saved to `sessionStorage` during login and retrieved as needed. Improves token handling for authenticated API calls.
Keycloak account information retrieval and update link handling added to SaleTunnel. Ensures proper verification flow in purchase steps.
Include `referrer` and encoded `referrer_uri` parameters in the Keycloak account URL. Ensures proper redirection when linking back to the application.
Update Keycloak configuration to use 'standard' flow with PKCE and 'check-sso' on load. Add token refresh logic for improved user session handling.
Cleanup unused `AUTHENTICATION_KEYCLOAK_TOKEN` references from settings, context processors, and tests.
Add logic to handle expired tokens by removing them from sessionStorage. Improves reliability of authenticated API calls.
Purpose
Ensure the user's token is saved to
sessionStorageduring login and retrieved as needed. Improves token handling for authenticated API calls.