Is it possible to refresh token without Client Secret? #3618
-
As we know, Mobile APP/SPA can use "Authorization Code Flow with PKCE" to get Access Token and Refresh Token. But how does Mobile APP/SPA to refresh the token without client secret? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello @baominwang Mobile apps and Single Page Applications (SPAs) can refresh their tokens using the OAuth2 refresh token grant. The refresh token is a special token that can be used to obtain a new access token or ID token without the user's involvement. The refresh token is issued to the client during the initial token issuance and can be used to obtain a new token when the current token expires.
In this example, the client secret is not required to refresh the token. The client only needs the refresh token and the client ID. The client sends a POST request to the token endpoint with the refresh token and the client ID. If the refresh token is valid, the server responds with a new access token. Let me know if something remains unclear. |
Beta Was this translation helpful? Give feedback.
Hello @baominwang
See our blogpost OAuth2 with PKCE for Mobile Apps and Single Page Apps for some details how it works.
Mobile apps and Single Page Applications (SPAs) can refresh their tokens using the OAuth2 refresh token grant. The refresh token is a special token that can be used to obtain a new access token or ID token without the user's involvement. The refresh token is issued to the client during the initial token issuance and can be used to obtain a new token when the current token expires.
Here's an example of how to refresh an access token with Ory: