keep getting error retrieving access token for microsoft oauth and using 0.61.1
simkimsia opened this issue · comments
I keep getting this:
Code: unknown, Error: Error retrieving access token: b'{"error":"invalid_grant","error_description":"AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token.
This despite i have cleared cookies and made sure that i have cleared socialaccount table.
I have bumped to the 128 tier. Please let me know what more info i need to provide to get this over the hurdle. This is for a client. so it's kinda urgent.
I have just now created a Microsoft OAuth app and added it to the demo over here:
https://django.demo.allauth.org/accounts/login/
That at least confirms that things are working out of the box -- you can try signing in there as well.
As for the error, I did read that it can pop up if your app secret is expired/invalid. Can you check the secret?
Hi @pennersr
I am not using common.
I have indicated the tenant id and now i keep getting stuck at the sign up page after the authorization is done.
This is my loom https://www.loom.com/share/f730eb85f2c84a3290b5a6dd131dce93?sid=faa251ed-32af-43d0-8db6-6af793ac1164
This is my settings in socialapp table
The tenant in settings is exactly the same as the provider_id
Also this is my django_site
My socialtoken is empty
My socialaccount is empty
socialapp_sites just says site_id 1 and socialapp_id 1
The original issue keep getting error retrieving access token
I think was solved by me
- removing all the django-session, socialaccount_socialaccount, socialaccount_socialtoken
- upgrading all the libraries
- set the following settings
# Custom User not using username but using email ACCOUNT_USER_MODEL_USERNAME_FIELD = None ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_USERNAME_REQUIRED = False ACCOUNT_AUTHENTICATION_METHOD = "email"
Then i had a new issue where I keep getting redirected to signup page.
The reason was because I had an existing user that wasn't already connected to the oAuth provider. An issue that was asked and answered at https://stackoverflow.com/q/24357907/80353.
However, given the answer was outdated (written in 2014), I added my updated answer at https://stackoverflow.com/a/78254683/80353
The issue is now totally solved.
Thank you.