Comments (5)
Seems like django-allauth update to 0.62.0 changes how get_scope
is implemented, will downgrade django-allauth to 0.61.1 at the moment to have dj-rest-auth work together.
def get_scope(self, request):
settings = self.get_settings()
scope = list(settings.get("SCOPE", self.get_default_scope()))
dynamic_scope = request.GET.get("scope", None)
if dynamic_scope:
scope.extend(dynamic_scope.split(","))
return scope
def get_scope(self):
"""
Returns the scope to use, taking settings `SCOPE` into consideration.
"""
settings = self.get_settings()
scope = list(settings.get("SCOPE", self.get_default_scope()))
return scope
def get_scope_from_request(self, request):
"""
Returns the scope to use for the given request.
"""
scope = self.get_scope()
dynamic_scope = request.GET.get("scope", None)
if dynamic_scope:
scope.extend(dynamic_scope.split(","))
return scope
from dj-rest-auth.
My setup with django-allauth==0.61.1 and dj-rest-auth==5.0.2 was working fine for like months. Before a few days ago I started getting errors like the above and "allauth.socialaccount.providers.oauth2.client.OAuth2Error: Invalid id_token".
Check this reply by one of the main dev of allauth: #503 (comment)
Going back to django-allauth==0.57.1 solved my issues.
from dj-rest-auth.
I came across this issue while using Github as a provider and @shennnj's solution worked for me.
However, while using dj-rest-auth
6.0.0 and django-allauth
0.63.2, I noticed that the client class in dj-rest-auth
is being instantiated with an extra scope
argument.
in the validate
method of SocialLoginSerializer
, the client is instantiated with an extra scope
argument.
dj-rest-auth/dj_rest_auth/registration/serializers.py
Lines 121 to 134 in 429a270
This is not needed in the instantiation of a new client class
So to address this problem, I inherited SocialLoginSerializer
and removed the scope
argument
class CstmSocialLoginSerializer(SocialLoginSerializer):
def validate(self, attrs):
...
client = self.client_class(
request,
app.client_id,
app.secret,
adapter.access_token_method,
adapter.access_token_url,
self.callback_url,
scope_delimiter=adapter.scope_delimiter,
headers=adapter.headers,
basic_auth=adapter.basic_auth,
)
...
Then added the serializer to my GithubLoginView
class GitHubLogin(SocialLoginView):
adapter_class = GitHubOAuth2Adapter
callback_url = "..."
client_class = OAuth2Client
serializer_class = CstmSocialLoginSerializer
This solved my problem and I didn't get the error.
from dj-rest-auth.
We are encountering this issue with Apple login despite it previously functioning correctly.
from dj-rest-auth.
We are encountering this issue with Apple login despite it previously functioning correctly.
Downgrading to django-allauth to 0.61.1 Fixes the issue.
from dj-rest-auth.
Related Issues (20)
- Support django 5+ HOT 1
- Need Customized Email Template for User Registration
- How to set the jwt token expiration correctly? HOT 2
- How to manually generate uid and token for password reset
- Doesn't support Android Credential Manager for Google login from android
- allauth ACCOUNT_UNIQUE_EMAIL doesn't work as expected HOT 1
- How to change activate_url in dj-rest-auth after registration? HOT 1
- "Partitioned" attribute needed for the set-cookie header
- Password Reset Custom Email HOT 1
- For apps defined in the settings save will give an error
- erroneous imports leading to breakage in `django-allauth 0.62.x` HOT 1
- AssertionError at /api/google/login/: No exception message supplied
- Feature Request: Allow configuration for auto linking social account and local account for google provider
- Getting ConnectionRefusedError when register a new user. But the user saving to database. If I refresh the page, showing user exists. HOT 1
- Getting "password is too common" error, but the user is still being created in the database with the provided data.
- Encountering MultipleObjectsReturned Exception During Social Authentication
- Feature Request: Extensibility of the fields when using the RegisterSerializer
- Breaking Bug since Allauth v0.63.1 when registering using Google "User is already registered with this e-mail address" HOT 2
- Google Social Login Returining "Failed to exchange code for access token" HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dj-rest-auth.