Reputation: 449
I just started using the passport library recently and am a total noob. However, when I'm using my newly created facebook app to login I get the following error:
500 FacebookGraphAPIError: (#12) username is deprecated for versions v2.0 and higher
at /app/node_modules/passport-facebook/lib/strategy.js:167:21
at passBackControl (/app/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:124:9)
at IncomingMessage. (/app/node_modules/passport-facebook/node_modules/passport-oauth2/node_modules/oauth/lib/oauth2.js:143:7)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:929:16
at process._tickCallback (node.js:419:13)
A bit of research shows me that facebook's open graph api no longer supports the "username" field. However it looks like the passport library is not supporting version 2.
Upvotes: 1
Views: 426
Reputation: 45
The current latest version of the Facebook Graph API is v2.2. You can fix passport-facebook (it use v1.0) by overriding options :
passport.use(new FacebookStrategy({
clientID : 'XXX',
clientSecret : 'XXX',
callbackURL : 'XXX',
authorizationURL: 'https://www.facebook.com/v2.2/dialog/oauth',
tokenURL: 'https://graph.facebook.com/v2.2/oauth/access_token',
profileURL: 'https://graph.facebook.com/v2.2/me'
},
Upvotes: 1