Skip to content

Commit

Permalink
PR comments from Dmitry #707
Browse files Browse the repository at this point in the history
  • Loading branch information
Florent FAYOLLE committed Nov 9, 2023
1 parent c806d3c commit 3b097fd
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/server/lib/OIDCConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
*
* Expected environment variables:
* env GRIST_OIDC_SP_HOST=https://<your-domain>
* Host at which our /oauth2 endpoint will live, usually the same value as `APP_HOME_URL`.
* Host at which our /oauth2 endpoint will live. Optional, defaults to `APP_HOME_URL`.
* env GRIST_OIDC_IDP_ISSUER
* The issuer URL for the IdP, passed to node-openid-client, see: https://github.com/panva/node-openid-client/blob/a84d022f195f82ca1c97f8f6b2567ebcef8738c3/docs/README.md#issuerdiscoverissuer.
* This variable turns on the OIDC login system.
* env GRIST_OIDC_IDP_CLIENT_ID
* The client ID for the application, as registered with the IdP.
* env GRIST_OIDC_IDP_CLIENT_SECRET
Expand Down Expand Up @@ -66,6 +67,7 @@ export class OIDCConfig {
});
const clientSecret = section.flag('clientSecret').requireString({
envVar: 'GRIST_OIDC_IDP_CLIENT_SECRET',
censor: true,
});

const issuer = await Issuer.discover(issuerUrl);
Expand Down Expand Up @@ -140,7 +142,6 @@ export class OIDCConfig {
mreq.session.oidc = {
codeVerifier,
};
console.log('mreq.session = ', mreq.session);

return codeVerifier;
}
Expand All @@ -150,9 +151,7 @@ export class OIDCConfig {
if (!mreq.session) { throw new Error('no session available'); }
const codeVerifier = mreq.session.oidc?.codeVerifier;
if (!codeVerifier) { throw new Error('Login is stale'); }
console.log('mreq.session = ', mreq.session);
delete mreq.session.oidc?.codeVerifier;
console.log('zzzz mreq.session = ', mreq.session);
return codeVerifier;
}

Expand Down

0 comments on commit 3b097fd

Please sign in to comment.