here is my auth's flow:
- The user receives two tokens (access token with expiration time and refresh token without expiration time) after logging in
- for each user , The refresh token is stored in the database in a json column called refreshTokens(which is an array).
- on the client side, Both access token and refresh token are stored on the local storage.
- when user needs to be verified, If the access token is expired, a new access token is created using the refresh token and sent back to the user and keeps the user logged in.
- When the user logs out, the refresh token stored in the database (in the refreshTokens list) is removed.
my questions are:
- is this flow, secure?
- do i need to save refresh token on the cookie or is local storage good enough?