nvh95 / react-linkedin-login-oauth2

Easily get Authorization Code from Linked In to log in without redirecting.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with scope

pratiyush2706 opened this issue · comments

I haven't defined scope since it is not a required field but it still gives me this error.
error: "invalid_request" errorMessage: "You need to pass the "scope" parameter" from: "Linked In"

+1! This is also an issue with the Demo you provided: https://stupefied-goldberg-b44ee5.netlify.com/

image

@pratiyush2706 @nerdmax It seems LinkedIn have changed their API slightly and now require that the scope is explicitly stated. See here, which states "Scopes could previously be set as default through the developer portal instead of explicitly requesting them in this step. They must now be explicitly requested when requesting an authorization code."

So if you include scope="r_liteprofile+r_emailaddress+w_member_social" as a prop that should work for you. Those three are the default fields that you can find under 'Auth' > 'Permissions' in your app settings. If you want more than that you need to apply to LinkedIn for access to those - https://docs.microsoft.com/en-us/linkedin/shared/references/v2/profile/full-profile?context=linkedin/consumer/context

@chocobuckle Thank you so much for the quick response!

@pratiyush2706 @nerdmax Default scope is r_emailaddress in 1.0.8. The demo is updated also.
@chocobuckle Thanks for your explanation.
Feel free to reopen this issue if the problem still persists. Thanks

@nvh95 @chocobuckle how to get linkedin user unique id , i get code which is not useful, i want unique linkedin user id

<LinkedIn
                      clientId="777d0s26wvou9r"
                     scope="r_liteprofile+r_emailaddress"
                      onFailure={this.handleLinkedInFailure}
                      onSuccess={this.handleLinkedInSuccess}
                      redirectUri="http://localhost:3000/login/linkedin"
                    >
                      linkedin
                    </LinkedIn>

in the callback i get linkedin code