Search code examples
node.jsauthenticationjwtaccess-token

Why using JWT rather than store token in DB for authorize an access token in Node.js?


I am not really sure about JWT mechanism and why its better (if its) than just store and match user's token from his DB document to grant and access?


Solution

  • Main benefit from JWT is speed, you can verify the token to check if the user can access the resource and retrieve basic user information without doing any database query.