knownasilya/just-auth

Add authenticate middleware

knownasilya opened this issue · 2 comments

Should use the same methods from the router setup, e.g. getUser

var auth = justAuth({ ... });

app.use('/auth', auth.router);
app.use('/admin', auth.middleware, adminRouter);

There should be only one middleware, for checking the token, if invalid it sends a 401 and the client can chose to redirect to the login page or whatever.

As @ismyrnow mentioned here, we can make our middleware based on the express-authentication library.