-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Authorization Code Flow with Proof Key for Code Exchange (PKCE) does not support refresh token #292
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
Comments
Refresh tokens are only supported with confidential clients (with client_secret), its not secure to use refresh tokens with public clients but its possible following this recommendations: I also would like to see this options implemented, but now I'm authenticating again in bakground before the token expires. |
Public clients must also have access to refresh_token. Consider the following scenario: The user downloads your application from the app store, and every hour he has to go through the flow again (because of the short lifetime of the access_token). Certainly, because of the bad experience, the application will receive a bad rating. |
Native apps do not have the same recommendations as browser-based apps. So native apps should support refresh tokens with extending lifetime, even public clients without secret. |
I got a question about this rule (maybe not appropriate asking this question in here)
written in Oauth-browser-based-apps section 8 What's the difference between "given browser based apps a 24hr refresh_token + 1hr access_token" and "given 24hr access_token but no refresh_token"? |
@hofsa May I ask you to point me to an example with an Angular Client? |
@eiswind I used the "angular-oauth2-oidc" - library from the link you mentioned. I followed the steps on the project-page and was able to get the client up-and-running without any problems. Maybe you should use another authorization-server first. I used the one from OKTA. |
I agree with security concerns but If someone wants to support refresh_token with public clients too, here is a full demo with customizations. (@hofsa this may help you) |
Describe the bug
The Authorization Code Flow with Proof Key for Code Exchange (PKCE) allows an Angular-Client to successfully receive an ID-Token, an Access-Token and a Refresh-Token.
But when the client uses the Refresh-Token, he receives a http-StatusCode '401'.
Looks like the problem is in
, which has a special-case for the initial PKCE-request (authenticatePkceIfAvailable()) to handle requests without client_secret, but nothing to handle the Refresh-Token-Case after the initial PKCE-Request.
To Reproduce
Execute the Authorization Code Flow with Proof Key for Code Exchange (PKCE) like described under "Samples" and try to use the Refresh-Token.
Expected behavior
The call to "http://127.0.0.1:9000/oauth2/token" with request-parameters
shall return ID-Token, Access-Token and Refresh-Token like the first request with "code" and "code_verifier"
Sample
First request:
Redirects to:
Request for Tokens:
Returns the Tokens:
Using the Refresh-Token:
Returns '401', because Client could not be authenticated.
The text was updated successfully, but these errors were encountered: