Retrieving photo from Facebook using passport-facebook

前端 未结 5 1884
醉梦人生
醉梦人生 2021-02-13 02:44

I am able to retrieve basic user information via passport-facebook, following the below code and saving in mongodb:

app.get(\"/auth/facebook\", passport.authenti         


        
5条回答
  •  有刺的猬
    2021-02-13 03:04

    As this answer, it will be work better with this code.

    passport.use(new FacebookStrategy({
      clientID: FACEBOOK_APP_ID,
      clientSecret: FACEBOOK_APP_SECRET,
      callbackURL: FACEBOOK_APP_CALLBACK,
      profileFields: ['id', 'displayName', 'picture.type(large)', 'email', 'birthday', 'friends', 'first_name', 'last_name', 'middle_name', 'gender', 'link']
    }, (accessToken, refreshToken, profile, cb) => {
      const picture = `https://graph.facebook.com/${profile.id}/picture?width=200&height=200&access_token=${accessToken}`
      //
    }))
    

提交回复
热议问题