Skip to content

fix: remove original_id_token from auth cookie JWT#1932

Open
epipav wants to merge 2 commits into
mainfrom
fix/auth-callback-big-header
Open

fix: remove original_id_token from auth cookie JWT#1932
epipav wants to merge 2 commits into
mainfrom
fix/auth-callback-big-header

Conversation

@epipav
Copy link
Copy Markdown
Collaborator

@epipav epipav commented May 22, 2026

No description provided.

Signed-off-by: anilb <epipav@gmail.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_token from the custom OIDC cookie JWT payload and related validation.
  • Adds username and intercomJwt fields to the decoded token type and populates them during login and refresh flows.
  • Removes the token field from the /api/auth/user response 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()}`;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants