shouheiyamauchi / react-passport-example

An example application for authentication using a Node.js back-end and React JS front-end
186 stars 62 forks source link

DB request in middleware defeats point of JWT #5

Open skeet opened 6 years ago

skeet commented 6 years ago

This DB call isn't needed: https://github.com/shouheiyamauchi/react-passport-example/blob/6fc204bca2a1680f83be78b0ccb2b26cfee4a041/server/middleware/auth-check.js#L25

A valid, short-lived JWT should be enough to access an endpoint - you're getting no benefit if your middleware is doing a DB call every request...