Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add removeState as an option to processSigninResponse #1691

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

ZephireNZ
Copy link
Contributor

Use case:

We have a custom extension to OAuth/OIDC where the code is an OTP that the user is sent when the OAuth handshake starts. This code is used instead of the typical randomly generated code in exchange for an access token.

If this code is incorrect, the user cannot retry as the state (including PKCE challenge) gets removed from the store as soon as the code is used. With this change, we can pass removeState = true which means even if the validation fails, it can be reattempted with a different code.

Without this change, we have to mimic the behaviour of processSigninResponse by:

  • Calling readSigninResponseState directly with removeState = false
  • Editing the prototype of OidcClient so that _validator.validateSigninResponse() can be called by the application.
OidcClient.prototype.getValidator = function () {
  return this._validator;
};

Checklist

  • This PR makes changes to the public API
  • I have included links for closing relevant issue numbers

@pamapa pamapa added this to the 3.1.1 milestone Oct 14, 2024
@pamapa pamapa merged commit 76b88db into authts:main Oct 14, 2024
2 checks passed
@pamapa
Copy link
Member

pamapa commented Oct 14, 2024

This library can also be used as a SDK, like you do. Thanks for contributing.

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.

2 participants