passport-linkedin-oauth2
passport-linkedin-oauth2 copied to clipboard
Error when only r_emailaddress permission is requested
In case when only r_emailaddress
is requested (i.e. no r_liteprofile
), the following error is returned:
{ InternalOAuthError: failed to fetch user profile (status: 403 data: {"serviceErrorCode":100,"message":"Not enough permissions to access: GET /me","status":403
It looks like Strategy.prototype.userProfile
needs to be updated, to check scope
and request profile and/or email accordingly. Currently, the code assumes that r_liteprofile
is always granted.
Another issue is if scope
is specified in passport.authenticate()
:
https://gist.github.com/eezhal92/cf6b3892231b4f3c1be4b7055d394283#file-strategy-js-L235
it's not passed to OAuth2Strategy.prototype._loadUserProfile
:
https://gist.github.com/eezhal92/cf6b3892231b4f3c1be4b7055d394283#file-strategy-js-L363