Search code examples
facebook-graph-apipassport.jspassport-facebook

Better quality photo from passport-facebook


How does one get a better quality picture from passport-facebook, the picture that I recieve in photos[0].value is 50x50 which is pretty poor, I wish to get atleast 150x150.I was trying to mess with link - no luck. Is it possible to retrieve better quality profile picture?

Edit: My current fb strategy setup:

passport.use(new FacebookStrategy({
    clientID: 'xxxxxx',
    clientSecret: 'xxxxx',
    callbackURL: 'http://localhost:4242/facebook/cb',
    profileFields: ['id', 'name', 'displayName', 'photos', 'hometown', 'profileUrl'],
    passReqToCallback: true
}, ...

Solution

  • You should be able to specify the profileFields property as described in

    like the following to retrieve a larger picture:

    passport.use(new FacebookStrategy({
        // clientID, clientSecret and callbackURL
        profileFields: ['id', 'displayName', 'picture.type(large)', ...]
      },
      // verify callback
      ...
    ));
    

    or you could change the strategy.js file of the passport-facebook module at line 221 to

    'photos':      'picture.type(large)'
    

    See