0

Currently I have the following authflow:

  1. User logs in

  2. The server issues an accestoken sent as a response to the client, and the client saves it in the users browser as a cookie

  3. This access token is short lived (5min), and is refreshed every 5 minutes by a refresh token, so the access token stored in the cookie changes every 5 minutes.

  4. But well, my react app must read the cookie, get the accesstoken from there, send it to the verification server, and then this returns a true or false, and based on that i will get access to a specified react route.

    Point is, I dont see any problem in this system, the only thing im carrying in my accesstoken is a userID to read its refreshtoken from the database so it will be able to refresh the access token. But apparently having an access token stored in a cookie is a bad practice. Why would it be a bad practice? How else are you supposed to mantain that accesstoken in the users browser if its not storing somewhere as in a cookie?

mouchin777
  • 1,033
  • 1
  • 18
  • 37

1 Answers1

1

Posting the link from my comment, so this question has an answer: stackoverflow.com/a/40376819

Amir Schnell
  • 548
  • 2
  • 10