auth0 / passport-linkedin-oauth2

Passport Strategy for LinkedIn OAuth 2.0
MIT License
119 stars 106 forks source link

Get big user avatar #35

Closed striped-s0cks closed 8 years ago

striped-s0cks commented 8 years ago

Is there some way to get big user's avatar using passportjs? Now it's only 80x80

siacomuzzi commented 8 years ago

Try with the following scope: r_basicprofile -> picture-urls::(original)

striped-s0cks commented 8 years ago

I've tried everything. 'The scope is unknown' picture-urls::(original) picture-url::(original) r_basicprofile picture-urls::(original) r_basicprofile picture-url::(original) r_basicprofile -> picture-urls::(original) r_basicprofile -> picture-url::(original)

passport.use(new LinkedInStrategy({ clientID : configAuth.linkedinAuth.clientID, clientSecret : configAuth.linkedinAuth.clientSecret, callbackURL : configAuth.linkedinAuth.callbackURL, scope : [ 'r_basicprofile', 'r_emailaddress', 'picture-urls::(original)' ], passReqToCallback : true }

I also tried to use profileFields: ['picture-urls::(original)'] But I've got Error: Failed to serialize user into session

It happens because with profileFields body (https://github.com/auth0/passport-linkedin-oauth2/blob/master/lib/oauth2.js#L32) has next structure:

{"pictureUrls": { "_total": 1, "values": ["https://media.licdn.com/mpr/mprx/......"] }}

And here we got a big picture.

So, now question is how to combine profileFields and basic user info?

siacomuzzi commented 8 years ago

Please try with passport-linkedin-oauth2@1.4.0

var user_picture = user._json.pictureUrls.values[0];
striped-s0cks commented 8 years ago

Thank you! Sorry about old version. And thanks for making authorization easier!

Have a nice day.

siacomuzzi commented 8 years ago

it wasn't an old version, I created v1.4.0 a couple of minutes ago :)