Repository navigation
Fall back to the API when a session JWT's signing key is unknown - #322
Open
evan-twilio wants to merge 1 commit into
Open
evan-twilio wants to merge 1 commit into
evan-twilio wants to merge 1 commit into
Conversation
Session authenticate_jwt (B2C and B2B, sync and async) raised PyJWKClientError when the JWT's kid wasn't in the JWKS, or when its key type isn't supported by PyJWT. That error is now handled the same way as an expired JWT: local verification returns None and the SDK calls the Authenticate API. M2M and Connected Apps local verification are unchanged. Bumps the version to 15.3.1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Session JWT authentication now falls back to the Authenticate API when the SDK can't find a usable signing key for the JWT.
Before this change,
authenticate_jwtraised aPyJWKClientErrorwhen the JWT'skidwasn't in the JWKS, or when the key type was one PyJWT doesn't support. An expired JWT already falls back to the API, so this PR handles a missing key the same way, for B2C and B2B sessions, sync and async.RS256 tokens that are signed by a known key are still verified locally. M2M and Connected Apps local verification are unchanged.
This PR also bumps the version to 15.3.1.
Where this fits
This is the first of three steps toward letting Stytch projects sign JWTs with new key types, such as post-quantum keys:
Test plan
Tests added; all tests passing.