Refresh Token
Is to renew the Access Token in case the access token is expired.
Considering the following flow:
- Application authorise
- Server returns
access_token
andrefresh_token
- Application uses the
access_token
to authorised - Server approved the request
access_token
expires- Application uses the
access_token
to authorised - Server deny the request
- Application uses the
refresh_token
to get the newaccess_token
- Application uses the
access_token
to authorised - Application uses the
access_token
to authorise
Refresh token rotation
To avoid exposing the refresh token, we can rotate the refresh token every single time we receive a refresh token. So the flow happen as below:
access_token
expires- Client uses
refresh_token
to get a newaccess_token
- Server invalidate previous
refresh_token
and return newaccess_tolen
andrefresh_token
- Client stores the new
refresh_token