If you choose to use JWTs I suggest still keeping a database of tokens and validate against that. This way you have an option to revoke the token and force client to get a new one. This is useful for when token data becomes stale, e.g. email changed, roles added etc. Simply keeping it all in token is not enough.
I think that Auth Tokens are easy to understand, use, and implement. They can generally be invalidated if the developer feels that they have been compromised.
Some APIs also use self-invalidating auth tokens based on an expiry date. For more secure data, I'd prefer that.
This is controlled on browser level and most (all?) browsers implement this. Origin can be faked by just using anything that can make a http request, like curl. It exists to protect users not the server.
Comments (249) 36 threads
Earlier commentsSome APIs also use self-invalidating auth tokens based on an expiry date. For more secure data, I'd prefer that.
All comments shown.
Couldn't load more comments. Check your connection and try again.