✨(frontend) store and retrieve user token in sessionStorage#2724
✨(frontend) store and retrieve user token in sessionStorage#2724kernicPanel wants to merge 6 commits intomasterfrom
Conversation
There was a problem hiding this comment.
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.
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.
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
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.
| keycloakAccountLinkLabel: { | ||
| id: 'components.SaleTunnel.Information.keycloak.updateLinkLabel', | ||
| description: 'Label of the keycloak link to update account', | ||
| defaultMessage: 'please update your account', |
There was a problem hiding this comment.
| defaultMessage: 'please update your account', | |
| defaultMessage: 'Please update your account', |
Purpose
Ensure the user's token is saved to
sessionStorageduring login and retrieved as needed. Improves token handling for authenticated API calls.