Skip to content

Commit

Permalink
fix: authts#466 clear stale states when creating new one
Browse files Browse the repository at this point in the history
  • Loading branch information
pamapa committed Apr 28, 2022
1 parent 7a6a20c commit 1b39579
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/OidcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class OidcClient {
id_token_hint,
login_hint,
skipUserInfo,
nonce,
nonce,
response_type = this.settings.response_type,
scope = this.settings.scope,
redirect_uri = this.settings.redirect_uri,
Expand Down Expand Up @@ -128,6 +128,9 @@ export class OidcClient {
nonce,
});

// house cleaning
await this.clearStaleState();

const signinState = signinRequest.state;
await this.settings.stateStore.set(signinState.id, signinState.toStorageString());
return signinRequest;
Expand Down Expand Up @@ -206,6 +209,9 @@ export class OidcClient {
request_type,
});

// house cleaning
await this.clearStaleState();

const signoutState = request.state;
if (signoutState) {
logger.debug("Signout request has state to persist");
Expand Down

0 comments on commit 1b39579

Please sign in to comment.