Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_app use client_id for oauth to circumvent multipelobjectsreturned #3912

Open
jonathan-s opened this issue Jun 22, 2024 · 2 comments
Open

Comments

@jonathan-s
Copy link

Providers that implement oauth, and thus use a client id, when making that initial login you could support a get parameters to fetch the client_id from there (if available).

That would make it possible to use several providers of the same type without using different sites.

I would also add that currently you'll get a nasty 500 error as get_app can throw a MultipleObjectsReturned error which doesn't seem to be caught in the views.

Would you accept a patch for these changes?

@jonathan-s jonathan-s changed the title get_app use client_id for oauth get_app use client_id for oauth to circumvent multipelobjectsreturned Jun 22, 2024
@pennersr
Copy link
Owner

Thoughts:

  • For OpenID Connect, which is what the OAuth providers are slowly migrating to, you can already have multiple providers of the same kind (by specifying APPS).
  • On a model level, the SocialAccount model has a unique_together = ("provider", "uid") which would be impacted.
  • I would like to first understand the use case a bit more. Can you elaborate?
  • Also, what providers would you want to use this with, and aren't they perhaps already supporting OpenID Connect?
  • Wondering, as a user, suppose I can authenticate using Facebook using ?client_id=1 and ?client_id=2, how would I be able to make the choice between those two options, and what does it even matter if I choose 1 or 2 ?

@pennersr
Copy link
Owner

MultipleObjectsReturned error which doesn't seem to be caught in the views.

That is indeed not caught as this is considered misconfiguration. The only thing that could be done is to catch it and raise an ImproperlyConfiguredException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants