Skip to content

Commit

Permalink
refactor: return undefined from local token verifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Kabo committed Jan 9, 2024
1 parent 83e6464 commit 0c4492c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions server/oauth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export const performAuthorizationCodeFlow = async (
*/
export const verifyOAuthCookiesLocally = async (
req: Request,
): Promise<VerifiedOAuthCookies> => {
): Promise<VerifiedOAuthCookies | undefined> => {
const accessTokenCookie = req.signedCookies[OAuthAccessTokenCookieName];
const idTokenCookie = req.signedCookies[OAuthIdTokenCookieName];

Expand All @@ -300,13 +300,7 @@ export const verifyOAuthCookiesLocally = async (
accessToken,
idToken,
};
} else {
// Access or ID token invalid, return empty object
return {};
}
} else {
// No access token or ID token cookie found, return empty object
return {};
}
};

Expand Down
4 changes: 2 additions & 2 deletions server/oauthConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export const OAuthIdTokenCookieName = 'GU_ID_TOKEN';
export const OAuthStateCookieName = 'GU_oidc_auth_state';

export interface VerifiedOAuthCookies {
accessToken?: OktaJwtVerifier.Jwt;
idToken?: OktaJwtVerifier.Jwt;
accessToken: OktaJwtVerifier.Jwt;
idToken: OktaJwtVerifier.Jwt;
}

export const oauthCookieOptions: CookieOptions = {
Expand Down

0 comments on commit 0c4492c

Please sign in to comment.