Friday, 26 May 2017

How to use basic auth in express.js with some anonymous endpoints?

I'm creating an express api in node and thanks to express-basic-auth, setting up basic authentication is as easy as

app.use(basicAuth({
    users: { 'username': 'password' }
}));

However this protects all endpoints in the app, and I would like to configure some of them to allow anonymous access. What would be the best way to do about doing that?



via tVoss42

No comments:

Post a Comment