access with every request.
Get a token
Response 200
username, but it holds your email.
Send the token
Add this header to every request except getting and refreshing a token:Token lifetime
Refreshing with
refresh returns a new access but does not issue a new refresh. One day after sign-in you can no longer refresh, so the simplest approach is:
- Store
accessand its expiration time. It is in theexpfield inside the token (Unix time in seconds). - When less than a day is left before
exp, or the API responds with401, get a new pair with email and password. - Retry the original request once with the new token.
Token expiration
Errors
Do you sign in to the cabinet with Google? Such an account may have no password. Set one on the password recovery page, and API sign-in will work.