Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook api use 2.4, but strategy still use 2.2 #127

Open
Rukeith opened this issue Jul 20, 2015 · 6 comments
Open

Facebook api use 2.4, but strategy still use 2.2 #127

Rukeith opened this issue Jul 20, 2015 · 6 comments

Comments

@Rukeith
Copy link

Rukeith commented Jul 20, 2015

I saw the facebook api will update to v2.4
I use passport-facebook to make a simple sign up website
But it showed up the module still use v2.2

function Strategy(options, verify) {
  options = options || {};
  options.authorizationURL = options.authorizationURL || 'https://www.facebook.com/v2.2/dialog/oauth';
  options.tokenURL = options.tokenURL || 'https://graph.facebook.com/oauth/access_token';
  options.scopeSeparator = options.scopeSeparator || ',';

  OAuth2Strategy.call(this, options, verify);
  this.name = 'facebook';
  this._clientSecret = options.clientSecret;
  this._enableProof = options.enableProof;
  this._profileURL = options.profileURL || 'https://graph.facebook.com/v2.2/me';
  this._profileFields = options.profileFields || null;
}

I have modify the version 2.2 to 2.3 and v2.4 it doesn't work.
I recommend this part can be updated, or I can send a pull request to it ?

@mirkods
Copy link

mirkods commented Oct 5, 2015

👍

@YissacharB
Copy link

+1
Any update on that?

@dsoike
Copy link

dsoike commented Nov 10, 2015

I had a similar issue. All I got back was profile = {id: facebookId, name: fullName}. I forked the project, changed v2.2 to v2.5 in '/lib/strategy.js', and the profile came back with all the fields I asked for. Hope this helps!

@Amberlamps
Copy link

I don't see what the problem is? You can just overwrite the profileUrl and attach the fields that you like as parameters:

passport.use(new FacebookStrategy({
    clientID: 'xxxxxxxx',
    clientSecret: 'xxxxxxxxxxx',
    callbackURL: "http://localhost:3000/auth/facebook/callback",
    profileURL: 'https://graph.facebook.com/v2.5/me?fields=email',
    enableProof: false
  },
  function(accessToken, refreshToken, profile, done) {
    return done(null, profile); 
  }
));

@LeandroFavero
Copy link

Amberlamps,

Not work for me. I tried:
profileURL: 'https://graph.facebook.com/v2.5/me',
profileFields: ['id', 'displayName','gender','emails','birthday','location']

But emails, birthday and location don't come.

@Amberlamps
Copy link

Well, this is not what I wrote. Even though your solution should work, when I take a look at the code solely, I suggested to put the fields in profileURL directly, like "profileURL": "https://graph.facebook.com/v2.5/me?fields=email,birthday".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants