-
-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom 401 handler #36
Comments
+1 |
I agree, what would need to be done to make 401 possible? |
+1 |
I'm having the same issue. I opened: http://stackoverflow.com/questions/37330642/passport-local-mongoose-how-to-get-authentication-error-message You could provide a callback to Passport's authenticate middleware, but then you'd have to parse the challenge string to get the useful information. |
+1, is there any workaround for this? |
You can always intercept the middleware with another one that gives it a proxy (fake) response object and "next" function, and modify its response. npm probably has some modules for this purpose but I don't know any from head. |
+1 would be great if there was an option to resolve with an empty token instead of responding with 401 to the client. I had an issue where I wanted to support guest (no token) and registered requests. I got around it by adding an extra middleware that adds a dummy authorization header for guest accounts, but the better solution would be to allow the developer to handle the empty token. |
Looking at current code base I don't see any way to plug-in a custom error handler when invalid bearer token provided. Would be great to have a way to customize the response, e.g. in my case I output JSON with error description..
The text was updated successfully, but these errors were encountered: