Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FacebookGraphAPIError: (#100) Tried accessing nonexisting field (user_photos) on node type (User)

I'm using passport.js for Facebook authentication and I started to get this error recently. Full error message looks like this:

FacebookGraphAPIError: (#100) Tried accessing nonexisting field (user_photos) on node type 
(User) at D:\app\node_modules\passport-facebook\lib\strategy.js:167:21 at passBackControl 
(D:\app\node_modules\passport-facebook\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:124:9) 
at IncomingMessage.<anonymous> (D:\app\node_modules\passport-facebook\node_modules\passport-oauth2\node_modules\oauth\lib\oauth2.js:143:7) 
at IncomingMessage.emit (events.js:129:20) at _stream_readable.js:908:16 at 
process._tickCallback (node.js:355:11)

I tried different approaches to set permissions scope. Initially I declared it in

passport.use(new FacebookStrategy({
    profileFields     : ['user_photos', 'user_friends'],
}

Then I moved it to

app.get('/auth/facebook', passport.authenticate('facebook', 
{ scope : ['email, public_profile, user_photos, user_friends'] }));

And it still causes the same error, as well as user_friends if I remove user_photos. Any ideas on what am I doing wrong? Core of my authentication script was inspired by this tutorial https://scotch.io/tutorials/easy-node-authentication-facebook

like image 965
vitalym Avatar asked Feb 19 '15 21:02

vitalym


1 Answers

"Some Facebook integrations require approval before public usage."

https://developers.facebook.com/docs/facebook-login/permissions/

Your app, either in production or in testing, needs to be reviewed.

https://developers.facebook.com/docs/facebook-login/review/how-to-submit

Until reviewed and approved by Facebook, your app can use only the public profile of an user and his/her email.

like image 114
Florin Sima Avatar answered Oct 26 '22 19:10

Florin Sima