pennersr / django-allauth

Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.
https://allauth.org
MIT License
9.51k stars 3.03k forks source link

OKTA login button disappeared #3461

Closed danil-smirnov closed 1 year ago

danil-smirnov commented 1 year ago

Hi,

I've upgraded django-allauth from 0.54.0 to 0.56.1 and the OKTA login button has disappeared from my application (Mailman 3). If I switch back to 0.54.0 I can see the login button again.

I'm using the code from the docs to configure the provider: https://django-allauth.readthedocs.io/en/latest/socialaccount/providers/okta.html

Could you help fix this, please?

pennersr commented 1 year ago

I assume that this is not the only configuration you have:

OCIALACCOUNT_PROVIDERS = {
    'okta': {
        'OKTA_BASE_URL': 'example.okta.com',
        'OAUTH_PKCE_ENABLED': True,
    }
}

Did you setup a SocialApp containing the Okta credentials? And, if you are using the sites framework, did you make that app available to your test site?

danil-smirnov commented 1 year ago

@pennersr As I said I can see the button if I simply downgrade to the version 0.54.0 - so the configuration seems sufficient to show the button.

If I go directly to /accounts/okta/login/, then I see the following error in the logs:

ERROR 2023-10-02 18:53:24,018 30 django.request Internal Server Error: /accounts/okta/login/
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
               ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 86, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/allauth/socialaccount/providers/base/mixins.py", line 9, in dispatch
    provider = self.adapter.get_provider()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/allauth/socialaccount/providers/oauth2/views.py", line 46, in get_provider
    return get_adapter(self.request).get_provider(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/allauth/socialaccount/adapter.py", line 204, in get_provider
    app = self.get_app(request, provider=provider)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/allauth/socialaccount/adapter.py", line 286, in get_app
    raise SocialApp.DoesNotExist()
allauth.socialaccount.models.SocialApp.DoesNotExist

I didn't add a social app in the Django admin yet, but the button was there before even without any social app configured.

pennersr commented 1 year ago

In that case the old behavior is actually a bug -- it does not make sense to show a button of a provider that is not going to work anyway because of missing configuration.