Answer the question
In order to leave comments, you need to log in
Why is a refresh token needed?
I don't understand why you need a refresh token. On the Internet, I found 2 reasons:
1) Refresh token can be sent not with every request, but only occasionally, which reduces the risk of interception. And the access token is sent frequently, but has a short lifetime. But what if I store tokens in HTTPonly cookies? In any case, cookies are sent with each request, and given that all requests are protected by SSL, there seems to be no security problems here. In any case, HTTPonly cookies are the safest place to store tokens in a browser.
2) Refresh token allows you to avoid using one session on 2 devices at the same time (in case of theft of tokens) due to the fact that each refresh token can be used only 1 time and when trying to use the same refresh token again, we can reset the session.
Total. The first point does not make sense when storing tokens in HTTPonly cookies, and the second point can be implemented using a single self-renewing token, which will have a short period of use as an access token and a long period as a refresh token. So what is the essence of the refresh token?
Answer the question
In order to leave comments, you need to log in
Definition of token in RFC
Refresh tokens are credentials used to obtain access tokens. Refresh
tokens are issued to the client by the authorization server and are
used to obtain a new access token when the current access token
becomes invalid or expires, or to obtain additional access tokens
with identical or narrower scope (access tokens may have a shorter
lifetime and fewer permissions than authorized by the resource
owner). Issuing a refresh token is optional at the discretion of the
authorization server.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question