0

According to my scenario, when the user signsup, he will get an SMS where he'll have to enter it to the application. At this point I will consider that the user is authenticated. I am using passport.js for this purpose. My code is given below. I have remove the authenticating via SMS code to keep this simple. When the code is executed I get a 400 error message. How can i solve this ?

var express = require('express');
var router = express.Router();
var csrf = require('csurf');
var passport = require('passport');


var csrfProtection = csrf();
router.use(csrfProtection);


var fs = require('fs');
var ejs = require('ejs');

router.post('/confirmationsignup', passport.authenticate('local'), function(req, res) {
          user.confirmSignUp(params, function(err, data) {

                 if (err) res.redirect('a/asa');
      });

  });


module.exports = router;
Illep
  • 16,375
  • 46
  • 171
  • 302
  • please share what is the field your using for ````username```` and ```password``` - also *refer* this answer http://stackoverflow.com/questions/34714202/passport-local-returns-error-400-bad-request-with-angular – Raj Adroit Jul 15 '16 at 10:33
  • `phoneNum` as the username and `confirmCode` as the `confirmation code`. This can be considered as the password – Illep Jul 15 '16 at 10:50

0 Answers0