Based on this article and this question, refresh tokens are to be long lived and access tokens are to be short lived. I would store my refresh token for more or equal to 60 days and my access token for 20 minutes or more/less but never more than an hour.
My main pain point in understanding the use of these tokens is the storage method for both tokens. I understand that I should store the refresh token as httpOnly
making it inaccessible via script (XSS attacks) and store the access token locally, either localStorage
or sessionStorage
for use in API calls as a key. Is it the correct way to do so? Should I further encrypt the refresh token as recommended in the article? Any insight would be much appreciated, thanks for reading.