fix: issue with refreshing token when client_secret is not set #513
+29
−2
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.
Fix for #506
Problem: The support for PKCE (Proof Key for Code Exchange) was introduced in the library, making the
client_secret
field optional (see commit e6afdfb). However, theclient_secret
field is still included in the list of validated fields in therefresh()
method (Service.js#L667).Issue: When creating a client without setting a
client_secret
(using PKCE for authentication), the token cannot be refreshed after its default expiration of one hour. This is because the validation check in therefresh()
method expects aclient_secret
, causing an error in the PKCE flow.Proposed Fix: Adjust the validation logic in the
refresh()
method to account for the possibility that theclient_secret
is not provided when using PKCE. This ensures that the token can still be refreshed in the absence of aclient_secret
.