Code Monkey home page Code Monkey logo

Comments (5)

pennersr avatar pennersr commented on August 22, 2024

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.

adlindenberg avatar adlindenberg commented on August 22, 2024

@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.

adlindenberg avatar adlindenberg commented on August 22, 2024

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.

pennersr avatar pennersr commented on August 22, 2024

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.

adlindenberg avatar adlindenberg commented on August 22, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.