Comments (5)
What is it that you are attempting to accomplish? As the name implies, _fetch_user_info()
is a private function, so you should not be using that at all?
from django-allauth.
@pennersr -- we're not using it explicitly, we're using just using GoogleOauth2Adapter
class in our login flows but it's 500ing because of issues in fetch_user_info
(call to identity URL with JWT returns 401) -- see stack trace. My issue is that we have a valid JWT -- being passed here?
...
File "/usr/local/lib/python3.9/site-packages/dj_rest_auth/views.py", line 125, in post
self.serializer.is_valid(raise_exception=True)
File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 227, in is_valid
self._validated_data = self.run_validation(self.initial_data)
File "/usr/local/lib/python3.9/site-packages/rest_framework/serializers.py", line 429, in run_validation
value = self.validate(value)
File "/usr/local/lib/python3.9/site-packages/dj_rest_auth/registration/serializers.py", line 158, in validate
login = self.get_social_login(adapter, app, social_token, response={'id_token': id_token})
File "/usr/local/lib/python3.9/site-packages/dj_rest_auth/registration/serializers.py", line 62, in get_social_login
social_login = adapter.complete_login(request, app, token, response=response)
File "/usr/local/lib/python3.9/site-packages/allauth/socialaccount/providers/google/views.py", line 89, in complete_login
data = self._fetch_user_info(token.token)
File "/usr/local/lib/python3.9/site-packages/allauth/socialaccount/providers/google/views.py", line 114, in _fetch_user_info
raise OAuth2Error("Request to user info failed")
allauth.socialaccount.providers.oauth2.client.OAuth2Error: Request to user info failed
from django-allauth.
It seems like a config issue but we have profile
and openid
in our scope and we were just upgrading the library so I'm not sure what we weren't configured for?
from django-allauth.
It's a bit difficult to assess what is going on here, but it is clear that this is not an issue in allauth itself. It looks more like an incompatibility between dj-rest-auth and allauth.
PS: You might want to consider switching to this: https://docs.allauth.org/en/latest/headless/api.html
from django-allauth.
@pennersr in the end it was related to this issue -- the fix was us passing an additional param, id_token
(assigned the access token value) and all good.
iMerica/dj-rest-auth#503 (comment)
from django-allauth.
Related Issues (20)
- [Password Reset] Prevent reset requests for "social only" users HOT 2
- Google auth not working on development environment
- [Headless MFA Deactivation] Always require reauthentication HOT 2
- Bearer Token fails to authenticate django rest api endpoints HOT 2
- [Headless Reauth] "Needs to reauthenticate" view? HOT 1
- Impossible to save Twitter OAuth1.0a token HOT 2
- Cannot override headless inputs HOT 11
- Determining minimal content for password reset email template including {{ password_reset_url }}
- allauth.account.middleware.AccountMiddleware breaks ASGI application HOT 1
- [Bug] bound_field attributes such as Tabindex, autocomplete are not available in fields.html HOT 7
- Headless Social account Google OAuth fails with error unknown HOT 5
- Should allauth include HTML email templates in addition to plain text email templates? HOT 2
- settings.ACCOUNT_AUTHENTICATION_METHOD MANDATORY Phone Number with Verification
- Authentik OIDC error in paperless-ngx
- Problem with current session API + mfa + social auth HOT 6
- Verifying current session, does not return new tokens HOT 1
- [Query] Social Account per Website rather on User account level
- [Query] Does the framework support Facebook Login for Business?
- How to prevent bots from creating unnecessary sessions in django-allauth?
- Incorrect Relying Party (rp) ID in WebAuthn Creation Options Leading to DOMException
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 django-allauth.