Code Monkey home page Code Monkey logo

Comments (7)

pennersr avatar pennersr commented on June 11, 2024

Can you paste a complete stack trace?

from django-allauth.

andreage avatar andreage commented on June 11, 2024

Traceback (most recent call last):
File "VIRTUALENV_PATH/python3.9/site-packages/django/core/handlers/exception.py", line 55, in inner
response = get_response(request)
File "VIRTUALENV_PATH/python3.9/site-packages/django/core/handlers/base.py", line 197, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 84, in view
return self.dispatch(request, *args, **kwargs)
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 162, in dispatch
return complete_social_login(request, login)
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/helpers.py", line 208, in complete_social_login
sociallogin.lookup()
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/models.py", line 282, in lookup
provider_id = self.account.get_provider().id
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/models.py", line 141, in get_provider
provider = self._provider = adapter.get_provider(
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/adapter.py", line 205, in get_provider
app = self.get_app(request, provider=provider)
File "VIRTUALENV_PATH/python3.9/site-packages/allauth/socialaccount/adapter.py", line 290, in get_app
raise MultipleObjectsReturned

Exception Type: MultipleObjectsReturned at /accounts/facebook/login/callback/

Raised during: allauth.socialaccount.providers.oauth2.views.view
Request information:
USER: AnonymousUser

Following the stack trace I see it might be here that the request gets lost?

image

Looking at the stack trace was definitely better than me randomly looking at the code. Thank you for pointing me to it.

from django-allauth.

pennersr avatar pennersr commented on June 11, 2024

The culprit is this line of code:

provider_id = self.account.get_provider().id

In order to return the provider we need to lookup the app, as that is a property of the provider instance (provider.app). But, in your case, there are multiple apps, so get_provider() gets confused. While passing request here (get_provider(request)) would solve the issue, we actually don't need the full provider here, only its ID. To be fixed.

from django-allauth.

andreage avatar andreage commented on June 11, 2024

Thank you very much, it makes much more sense now.

from django-allauth.

pennersr avatar pennersr commented on June 11, 2024

Upon closer inspection, there are other cases that need more than the ID. Fixed via f356138.

from django-allauth.

pennersr avatar pennersr commented on June 11, 2024

Can you try out the current main branch?

from django-allauth.

andreage avatar andreage commented on June 11, 2024

I'm sorry I thought I sent a reply to your question. It's working perfectly for me now!

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.