Add PKCE support (for v5-dev Typescript) #659
Open
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.
This pull implements PKCE support (RFC7636). It is originally based on pull #452, but has been cleaned up a bit. Changes should be almost identical to pull #658, but cleaned up for Typescript.
Summary of changes:
code_challenge
,code_challenge_method
, andcode_verifier
) are not passed to the server, the server behaves exactly the same as before. PKCE mode is enabled only when:code_challenge
(and optionallycode_challenge_method
) parameters are included during authorization code grant.code_verifier
parameter is included during token grant. Whencode_verifier
parameter is included,client_secret
is ignored since we are using PKCE for authentication.codeChallenge
andcodeChallengeMethod
) to the authorization code model. Changes are required toModel#saveAuthorizationCode
andModel#getAuthorizationCode
to persist and retrieve these 2 new fields if they are present.Model#saveAuthorizationCode
andModel#getAuthorizationCode
methods, they will continue to work just as they did before the change.Example of my changes to
saveAuthorizationCode
for a MongoDB model (in Typescript):Example of my changes to
getAuthorizationCode
for a MongoDB model (in Typescript)