I have created demo application with Express framework and PassportJS support(on top of node.js). I need to implement OpenID Authentication with Wargaming.net account(OpenID url is http://ru.wargaming.net/id/). But Passport module returns flash message "Missing OpenID identifier". Please, help me to find errors in my code.
passport.use(new OpenIDStrategy({
returnURL: 'http://localhost:3000/auth/openid/return',
realm: "http://localhost:3000/",
profile: true
},
function(identifier, profile, done) {
User.findByOpenID(identifier, function (err, user) {
done(err, user);
});
}
));
app.post('/auth/openid', passport.authenticate('openid'));
app.post('/auth/openid/return',
passport.authenticate('openid', { successRedirect: '/',
failureRedirect: '/login',
failureFlash: true }));
The problem was in getting profile. I still don't know what is wrong. So I removed asking profile and changed url "/auth/openid/return" to GET request. So code is working fine now.