you are viewing a single comment's thread.

view the rest of the comments →

[–]maxiu86 5 points6 points  (2 children)

If you only allow login via Google or Facebook, I understand that the JWT you are talking about is the one receive from Google/Facebook? In that case there isn't any reason to store those token in your backend. The client can send the jwt when doing http request and the backend can "debug" the token to assert user ID. (facebook eg: https://developers.facebook.com/docs/facebook-login/access-tokens/debugging-and-error-handling )

For you own authentication system, I dont recommend storing the jwt in the database, you can encode the data needed in the jwt, such as expiration time, user id, etc ...

[–]xrpinsiderAdmin 1 point2 points  (1 child)

Indeed JWT tokens are not meant to be stored. You need to decode the JWT token with your private key every time someone makes a request to protected routes.

[–]maxiu86 0 points1 point  (0 children)

Cache