Passport-Facebook not providing email even if it is in scope

后端 未结 3 2030
旧时难觅i
旧时难觅i 2021-02-04 03:09

In my application i register the facebook-strategie as follows: But the returned profile does not contain the email-field....

passport.use(new FacebookStrategy({         


        
3条回答
  •  生来不讨喜
    2021-02-04 03:57

    From Facebook graph APIv2.4, we need to explicitly specify fields to get.

    Introducing Graph API v2.4

    So, we can write like:

      passport.use(new FacebookStrategy({
          clientID: config.facebook.clientID,
          clientSecret: config.facebook.clientSecret,
          callbackURL: config.facebook.callbackURL,
          profileFields: ['id', 'email', 'gender', 'link', 'locale', 'name', 'timezone', 'updated_time', 'verified'],
        },
    

提交回复
热议问题