Skip to content

Commit

Permalink
Merge pull request #454 from bseenu/use_access_token
Browse files Browse the repository at this point in the history
Allow access_token
  • Loading branch information
tianni4104 authored Jun 30, 2024
2 parents e0e00bd + d45862c commit ac33318
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const OIDC_SECRET = process.env.OIDC_SECRET;
const OIDC_URL = process.env.OIDC_URL;
const OIDC_SCOPES = process.env.OIDC_SCOPES || 'openid email';
const OIDC_USE_PKCE = process.env.OIDC_USE_PKCE === "true" || false;
const OIDC_USE_ACCESS_TOKEN = process.env.OIDC_USE_ACCESS_TOKEN === "true" || false;
const OIDC_METADATA = JSON.parse(process.env.OIDC_METADATA || '{}');
const clientMetadata = Object.assign({client_id: OIDC_CLIENT_ID, client_secret: OIDC_SECRET}, OIDC_METADATA);

Expand Down Expand Up @@ -209,6 +210,10 @@ async function oidcAuthenticate(code, redirectUri) {
}
}
const tokenSet = await provider.callback(redirectUri, {code}, authCheckParams);

if ( OIDC_USE_ACCESS_TOKEN ) {
return tokenSet.access_token;
}
return tokenSet.id_token;
}

Expand Down

0 comments on commit ac33318

Please sign in to comment.