fix: remove original_id_token from auth cookie JWT#1932
Open
epipav wants to merge 2 commits into
Open
Conversation
Signed-off-by: anilb <epipav@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes reliance on original_id_token being embedded in the app’s custom auth cookie JWT, and instead promotes specific needed claims (e.g. Intercom JWT, username) into the custom token so the frontend can consume them without carrying the raw Auth0 ID token.
Changes:
- Removes
original_id_tokenfrom the custom OIDC cookie JWT payload and related validation. - Adds
usernameandintercomJwtfields to the decoded token type and populates them during login and refresh flows. - Removes the
tokenfield from the/api/auth/userresponse and associated frontend state/types.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| frontend/types/auth/auth-user.types.ts | Removes token from AuthData to match the updated /api/auth/user payload. |
| frontend/types/auth/auth-jwt.types.ts | Replaces original_id_token typing with username and intercomJwt on the decoded OIDC token interface. |
| frontend/server/utils/jwt.ts | Simplifies optional-user cookie verification by removing original_id_token format checks. |
| frontend/server/utils/auth-refresh.ts | Adds username and intercomJwt claims into the signed cookie JWT during refresh. |
| frontend/server/middleware/jwt-auth.ts | Removes middleware validation that required original_id_token to be present/parseable. |
| frontend/server/api/auth/user.get.ts | Stops decoding the original ID token server-side; returns username/intercomJwt directly from the cookie JWT and drops token from response. |
| frontend/server/api/auth/logout.post.ts | Stops extracting id_token_hint from the cookie JWT; constructs logout URL without it and returns that URL. |
| frontend/server/api/auth/callback.ts | Adds username and intercomJwt claims into the signed cookie JWT during the Auth0 callback exchange. |
| frontend/composables/useAuth.ts | Removes token from auth state and from the composable API. |
| frontend/app/plugins/auth.client.ts | Updates default AuthData shape to match removal of token. |
| frontend/app/components/modules/auth/store/auth.store.ts | Removes token from the Pinia auth store. |
| frontend/app/components/modules/auth/components/login.vue | Stops reading/watching token and updates auth store sync logic accordingly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
13
to
+18
| iss: string; | ||
| aud: string; | ||
| iat: number; | ||
| exp: number; | ||
| original_id_token?: string; | ||
| username?: string; | ||
| intercomJwt?: string; |
Comment on lines
92
to
99
| // Update auth store when authentication state changes | ||
| watch( | ||
| [isAuthenticated, token], | ||
| ([newAuthVal, newToken]) => { | ||
| isAuthenticated, | ||
| (newAuthVal) => { | ||
| authStore.isAuthenticated = newAuthVal; | ||
| authStore.token = newToken || ''; | ||
| authStore.user = user.value; | ||
| }, | ||
| { immediate: true }, |
Comment on lines
+84
to
+89
| const auth0Base = | ||
| isProduction && parsedAuth0Domain.hostname === 'sso.linuxfoundation.org' | ||
| ? 'https://sso.linuxfoundation.org' | ||
| : `https://${config.public.auth0Domain.replace('https://', '')}`; | ||
|
|
||
| return { | ||
| success: true, | ||
| logoutUrl, | ||
| }; | ||
| } | ||
| } catch (tokenError) { | ||
| console.error('Error decoding OIDC token for logout:', tokenError); | ||
| // Continue with fallback logout | ||
| } | ||
| } | ||
| const logoutUrl = `${auth0Base}/v2/logout?${logoutParams.toString()}`; |
joanagmaia
approved these changes
May 22, 2026
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.
No description provided.