stevebest / passport-vkontakte

VK.com authentication strategy for Passport and Node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to get user's email

skotchio opened this issue · comments

commented

At now Vkontakte allows to get user's email via specifying scope: ['email'] parameter:

app.get('/auth/vkontakte',
  passport.authenticate('vkontakte', scope: ['email']),
  function(req, res){
    // The request will be redirected to vk.com for authentication, so
    // this function will not be called.
});

But unfortunately I don't get this one:

passport.use(new VkontakteStrategy({
    clientID: /* clientID */,
    clientSecret: /* clientSecret */,
    callbackURL:  /* callbackURL*/
},
function(token, refreshToken, profile, done) {
      console.log(profile.email) // undefined;
});

What I'm doing wrong?

It was explained in #13

commented

@stevebest thanks for the help. It works 👍

Could you explain why don't you want merge this fix #14

At now in case of any error we get erorr throw and unable to catch it. There are a lot of issues on SO related this bug: http://stackoverflow.com/questions/22494675/passport-oauth2-seems-not-to-handle-not-getting-an-access-token

Bassicly saying, failureRedirect options dosen't work.

Just don't have time to review thoroughly. Also, not working with VK APIs at the moment, so it's kinda low priority. Sorry about that, really.

commented

@stevebest no problem. Thanks for the passport-vkontakte module. It's very helpful for me :)

look for this lines of codes: https://github.com/jaredhanson/passport-oauth2/blob/master/lib/strategy.js#L192, so you must provide function with 5 arguments, and you can get email in params argument.