-
-
Notifications
You must be signed in to change notification settings - Fork 497
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
Manually input variable for credentials instead of using a form #69
Comments
I think what you do is this: passport.use(new LocalStrategy({
usernameField: 'username',
passwordField: 'password'
},
function(username, password, done) {
// ...
}
)); As long as the json you post from angularjs is something like: |
I have the same issue (also using Angular.js). It is impossible to use the username and password from json if it is nested, say: POST /api/users/login
{
user: {
email: '936@xkcd.com',
password: 'correct horse battery staple'
}
} I've tried setting Alternatively, maybe allow us to override the object passed to Strategy.authenticate? In my case, it would be something like: passport.use(new LocalStrategy({
usernameField: 'email',
passwordField: 'password',
object: req.body.user
},
function(username, password, done) {
// ...
}
)); |
It takes a form-style notation for nesting:
|
Thanks! |
From the piece of the code that was given for an example in passportjs documentation
passport.use(new LocalStrategy(
function(username, password, done) {
I finally realise that PassportJS try to automatically get the username / password field in the post request automatically but the problem is that I am using angularjs and ajax to do the submission so my post request for the login would be just a json object contains information scraped from the login form. Is there any option to manually pass the username and password directly as variable ?
The text was updated successfully, but these errors were encountered: