Django-allauth + reactjs+ linkedin login redirect uri issue + Not enough permissions to access: GET /me - django-rest-framework

I am using drf + ReactJs to do social login am able to integrate google login and facebook login using django allauth package , but when I tried to integrate linkedin login getting error :
invalid redirect uri
TO be more precise am getting this error
allauth.socialaccount.providers.oauth2.client.OAuth2Error: Error retrieving access token: b'{"error":"invalid_redirect_uri","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"}
----few updates after tying out few fixes -----
Tried fetching the access token from backend and login the user using a seprate api it showed the redirect uri issue.
Tried directly calling the linkedin token url from postman and now I get Invalid request error.
First method worked after few tryouts but now getting incorrect value error.
Tried fetching code with scope as r_liteprofile but now getting 403 forbidden
{'serviceErrorCode': 100, 'message': 'Not enough permissions to access: GET /me', 'status': 403}
I tried changing url to backend and frontend both showing same error. Can anyone get me how to fix this issue ?
I am not sure what all additional details needed for sorting this out, Please let me know if any needed.

Finally able to find the solution
the issue was with the code generated from the sdk used to implement linkedin login in reactjs, which has only scope
r_emailaddress
r_liteprofile
Adding additional scope
w_member_social
And regarding redirect uri issue
we are suppose to use the same redirect uri in both frontend and backend
made things working , posting this here since it will help someone in future facing same problem.
thank you all

Related

Kakao login giving KOE006

I am trying to add kakao login to my magento store but while calling I am getting this error after login
So I check the error https://developers.kakao.com/docs/latest/en/kakaologin/trouble-shooting against KOE006 which says 'You used an unregistered Redirect URI when requesting an authorization code.'. So I verified my redirect URI at [My Application] > [Kakao Login] which was correct.
Can you please let me know it's reason and solution?
My mistake I was using the key Native app key. Rather correct key is REST API key. I hope it will help you and save your time.

Laravel Socialite Twitter Provider - Could not authenticate

I'm using Laravel Socialite in a project and added the Twitter Provider in order to be able to allow my users to integrate with their Twitter account. I followed the steps here https://socialiteproviders.com/Twitter/ and I'm getting the following error:
Received HTTP status code [401] with message "{"errors":[{"code":32,"message":"Could not authenticate you."}]}" when getting temporary credentials.
If I leave the TWITTER_REDIRECT_URI in my env file blank, the error goes away and the Oauth flow works exactly as it's supposed to. Is anyone else having this issue? If the TWITTER_REDIRECT_URI isn't needed why have it in the docs?

Laravel passport Oauth2 "Requesting Tokens"

I am working with Zapier, and trying to authenticate user using OAuth2. I am using the Laravel(5.5) Passport(^4.0).
I am trying to use defalut passport routes "https://laravel.com/docs/5.5/passport".
But when it goes to "oauth/authorize" GET method and if user is not logged in then gives me {"error":"Unauthenticated."} instead of redirecting to Login page. And if user is logged in already then worked well.
Is there something i am missing and where I can check to resolve this issue.
Thanks and Regards
You are working with Oauth2 so you will get 401 and {"error" : "Unauthenticated"}. It is up to you to handle the unauthenticated response to the server (e.g. your js front end will redirect or your mobile app show login page).

Passing accessToken from frontend to PHP API

I've been trying to get authentication working (described below) in my laravel application, following these two tutorials:
https://auth0.com/docs/quickstart/webapp/laravel/01-login
https://auth0.com/docs/quickstart/backend/laravel/01-authorization
On the frontend (angular app):
User clicks log in button and taken to auth0 login page
The user logs in and is redirected back to the callback with the accessToken
The access token is stored on the frontend and passed to Laravel API each request.
On the backend:
User makes a request to my http://localhost/api/route passing the accessToken in the authorisation header
Laravel validates the user is logged in and valid.
Laravel allows access to that route
It works to an extend, but when I try to use postman to access the protected route by passing the accessToken I get the error:
"message": "We can't trust on a token issued by: https://myprojectname.au.auth0.com/."
Is my workflow correct? What am I missing?
Thanks!
Just in case if somebody facing with the same issue. The authorized_iss must contain a trailing slash.
In the laravel-auth0.php file the field,
'authorized_issuers' => 'https://myprojectname.au.auth0.com/'
should be in this form.

Getting Error While Requesting Access Token by Authorization Code in Window Live in Asp.net

I am working on a Window Live Authentication. I have used the code from GitHub
My Process is
After Login into the Window Live (Hotmail.com)
It will give us one Authorization code which then we send it with the other detail to get the Access Token.
/*
e.g. Url to get the Access token by the Authorization code
https://login.live.com/oauth20_token.srf?client_id=XXredirect_uri=XX&client_secret=XX&code=7df98b56-0fe5-6898-44ed-5feb8d28f582&grant_type=authorization_code
*/
But I am facing the Error in Getting the Access token from the Authorization code
"The Error is : invalid_grant The provided value for the 'code' parameter is not valid. The code has expired."
Please help me.
Thank you
Vijay Chavda

Resources