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

Cannot login with linkedin/linkedin_oauth2 #1641

Closed
RamizSami opened this issue Feb 27, 2017 · 10 comments
Closed

Cannot login with linkedin/linkedin_oauth2 #1641

RamizSami opened this issue Feb 27, 2017 · 10 comments

Comments

@RamizSami
Copy link

I configured linkedin social application and tried to integrate it with both, 'allauth.socialaccount.providers.linkedin' and 'allauth.socialaccount.providers.linkedin_oauth2' but cannot login. This is my settings for both:
'linkedin': { 'SCOPE': [ 'r_emailaddress', 'r_basicprofile', ], 'PROFILE_FIELDS': [ 'id', 'first-name', 'last-name', 'email-address', 'picture-url', 'public-profile-url', ] }, 'linkedin_oauth2': {'SCOPE': ['r_basicprofile', 'r_emailaddress'], 'PROFILE_FIELDS': ['id', 'first-name', 'last-name', 'email-address', 'picture-url', 'public-profile-url', 'skills', 'headline']},
and this is my code in template:
for linkedin oauth2:
<a href="{% provider_login_url 'linkedin_oauth2' %}" next="/"> <button type="button" class="btn btn-linkedin waves-effect waves-light m-t-20"> <i class="fa fa-linkedin m-r-5"></i> Linkedin </button> </a>
for linkedin:
<a href="{% provider_login_url 'linkedin' %}" next="/"> <button type="button" class="btn btn-linkedin waves-effect waves-light m-t-20"> <i class="fa fa-linkedin m-r-5"></i> Linkedin </button> </a>

When using linkedin provider, the url /accounts/linkedin/login/ displays error message that there was an error while logging in.
When using likedin_oauth2 provider, the url /accounts/linkedin_oauth2/login/ redirects to https://www.linkedin.com/uas/oauth2/authorization?scope=&state=uCBu7AwHib3H&redirect_uri=http%3A%2F%2Flocalhost%3A8000%2Faccounts%2Flinkedin_oauth2%2Flogin%2Fcallback%2F&response_type=code&client_id=78ooxchybs44b and this URL cannot be decoded.
Please guide me what I am doing wrong?

@pennersr
Copy link
Owner

Please upgrade to 0.37.1

@fab10m
Copy link

fab10m commented May 28, 2019

Hello,

since yesterday I can't signin with linkedin connector anymore. I've been using the linkedin_oauth2 provider for about 2 years and I've already:

  • done the upgrade to the last release 0.39.1
  • checked that my app is verified by linkedin

This is the error I get
{ "error": "invalid_request", "error_description": "Unable to retrieve access token: appid/redirect uri/code verifier does not match authorization code. Or authorization code expired. Or external member binding exists" }

Does anyboby have the same issue?

Regards,
Fabio

@Bragegs
Copy link

Bragegs commented Dec 11, 2019

@fab10m Hi, did you manage to figure out what went wrong? Having the same issue

@fab10m
Copy link

fab10m commented Dec 20, 2019

Yes, I did. In my case the error was originated by the request for a field no longer supported by LinkedIn and the presence of the header's variable "x-li-src: msdk.

@ibrahimsamson
Copy link

@Bragegs Hi, did you manage to figure out what went wrong. I'm stuck too

@sainyamcc
Copy link

This still is there, django-allauth = "~=0.45.0" I am on.

@MahmoudBayoumi19
Copy link

i am have same issue:
I configured linkedin social application and tried to integrate it with both, 'allauth.socialaccount.providers.linkedin' and 'allauth.socialaccount.providers.linkedin_oauth2' but cannot login. This is my settings for both:
'linkedin_oauth2': {
'SCOPE': [
'openid',
'profile',
'w_member_social',
'email'
],
'APP': {
'client_id': '78na9m2trtpfji',
'secret': 'ysjmzp6lwKlrgNT1',
'key': ''
}
}
this url: /accounts/linkedin_oauth2/login/?process=login redirect to:
http://127.0.0.1:8000/accounts/linkedin_oauth2/login/callback/?code=AQQo34wWQ19rSQZy2D6ZT7i_sf2nEhT6HoYnxtwluOvh60Y5XVoEVDHNTmsX9RG5VDpv52PrtuPIsP5YXVGzuJOW3PwLJSbHWUumPHXtUcdrjg_gTaFDuPQwn_h2fsEsrY0BlibuxM5PR7mF34AuBMs5Hai1xF8rJaZUTLotaCMtdfOH-kc0sp8isDLc4R492gyY51fctE7ChVNZLZE&state=pnyyh12BgUsWAJ9l

@mohebmithani
Copy link

The flow implemented in this library needs to access me api of linkedin to get user details but i think linkedin has removed the access of these apis as per their new restrictions. Their new flow requires to use https://api.linkedin.com/v2/userinfo api.

I created my custom linkedin adapter using LinkedInOAuth2Adapter and overrode this method: get_user_info. I called the appropriate api inside this method and then transformed the data i got from linkedin to the format this library requires and things started to work. I am not sure if this is a good approach but it WORKED!.

The document for their new flow, OpenID is below:
https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2?context=linkedin%2Fconsumer%2Fcontext

@MahmoudBayoumi58
Copy link

new app in linkedin used openid_connect instead of use oauth2 so u need to use openid_connect config:
"openid_connect": {
"APPS": [
{
"provider_id": "oidc_linkedin",
"name": "LinkedIn",
"client_id": "",
"secret": "",
"settings": {
"server_url": "https://www.linkedin.com/oauth/.well-known/openid-configuration",
},
}
]
}
this worked for me

@imane-aj
Copy link

new app in linkedin used openid_connect instead of use oauth2 so u need to use openid_connect config: "openid_connect": { "APPS": [ { "provider_id": "oidc_linkedin", "name": "LinkedIn", "client_id": "", "secret": "", "settings": { "server_url": "https://www.linkedin.com/oauth/.well-known/openid-configuration", }, } ] } this worked for me

i used this settings but i have error OpenIDConnectAdapter.init() missing 1 required positional argument: 'provider_id'
, this is my code
class LinkediConnect(SocialConnectView):
adapter_class = OpenIDConnectAdapter

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

10 participants