You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using Passport for numerous years now. In the current platform that I run, I use Passport's local strategy for authentication. This has been working fine for several months.
Today, I added a new Basic Strategy authentication system to the mix. This is completely separate from the standard Local Strategy that already exists.
My code is as follows:
var basic = require('passport-http').BasicStrategy;
passport.use(new basic({},
function(username, password, done) {
console.log('here we are');
}
));
When I make a request to /the/correct/path, OUTSIDE AUTH gets printed properly. However, I then expect here we are from the passport.use() function to get printed, which it never. I'm really frustrated, as I have no idea how this is supposed to work...
I have tried accessing this via browser, via curl calls (as per the example), using older & newer versions of the module, and using the DigestStrategy instead of the BasicStrategy. Any advice on what to do would be greatly appreciated... Also I am NOT using express if that makes a difference at all...
Best, and thanks either way,
Sami
The text was updated successfully, but these errors were encountered:
I also had this issue. If I am not wrong, the local strategy in passport authenticates against form data. However, if you would like to authenticate using the basic strategy, you have to add an Authorization header.
I never used CURL to do my requests, you can try use Postman to do the calls. In Postman, you just have to click on the Basic Auth tab and enter the credentials and they will auto generate an Authorization header with your encoded credentials and you can send it to the server.
The header should look like this: Authorization Basic wegTIyNy3h32SDGdgd
Adding the authorization header triggered the basic strategy for me.
I saw a similar behavior where I was mounting the auth endpoint to a non-root endpoint via app.use('/auth', authApp) and the uri check was failing. I opened a separate issue #43 and submitted a pull request.
passport-http is pretty silent about which check is failing. I added checkpoints in passport-http to track down which check was failing. Once I saw that it was the URI check, it was pretty easy to figure out what was going wrong. Hope that helps.
Hi There,
I have been using Passport for numerous years now. In the current platform that I run, I use Passport's local strategy for authentication. This has been working fine for several months.
Today, I added a new Basic Strategy authentication system to the mix. This is completely separate from the standard Local Strategy that already exists.
My code is as follows:
and the following is part of a different function
When I make a request to
/the/correct/path
,OUTSIDE AUTH
gets printed properly. However, I then expecthere we are
from thepassport.use()
function to get printed, which it never. I'm really frustrated, as I have no idea how this is supposed to work...I have tried accessing this via browser, via curl calls (as per the example), using older & newer versions of the module, and using the DigestStrategy instead of the BasicStrategy. Any advice on what to do would be greatly appreciated... Also I am NOT using express if that makes a difference at all...
Best, and thanks either way,
Sami
The text was updated successfully, but these errors were encountered: