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

Using an OAuth source that doesn't exactly follow the OAuth specification #9870

Closed
Telmo26 opened this issue May 26, 2024 · 1 comment
Closed
Labels

Comments

@Telmo26
Copy link

Telmo26 commented May 26, 2024

Describe the bug
Hello, I want to use an external OAuth2 client as a source in Authentik, as this client doesn't provide the necessary scopes for other applications and I wanted to use Authentik's property bindings to solve this issue. However, I ran into the issue below while trying to import it : it seems as though the response token doesn't contain the "token_type" field.

To Reproduce
Unique to my case and my OAuth2 provider

Expected behavior
I would like to know if there's anything that I can do to make it work.

Logs

Stacktrace from authentik
Traceback (most recent call last):
  File "/ak-root/venv/lib/python3.12/site-packages/asgiref/sync.py", line 518, in thread_handler
    raise exc_info[1]
  File "/ak-root/venv/lib/python3.12/site-packages/django/core/handlers/base.py", line 253, in _get_response_async
    response = await wrapped_callback(
               ^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/asgiref/sync.py", line 468, in __call__
    ret = await asyncio.shield(exec_coro)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/asgiref/current_thread_executor.py", line 40, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/asgiref/sync.py", line 522, in thread_handler
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/django/utils/decorators.py", line 48, in _wrapper
    return bound_method(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/django/views/decorators/csrf.py", line 65, in _view_wrapper
    return view_func(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/sources/oauth/views/dispatcher.py", line 26, in dispatch
    return view.as_view()(*args, source_slug=source_slug, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/ak-root/venv/lib/python3.12/site-packages/django/views/generic/base.py", line 104, in view
    return self.dispatch(request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/sources/oauth/views/callback.py", line 47, in dispatch
    raw_info = client.get_profile_info(self.token)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/authentik/sources/oauth/clients/oauth2.py", line 150, in get_profile_info
    headers={"Authorization": f"{token['token_type']} {token['access_token']}"},
                                 ~~~~~^^^^^^^^^^^^^^
builtins.KeyError: 'token_type'

Version and Deployment (please complete the following information):

  • authentik version: 2024.4.2
  • Deployment: docker-compose

Additional context
The OAuth2 provider is a student association and I already told them about the issue, but they have a reputation of not tackling even the small issues, and this is a big one so I don't expect a resolution on their side anytime soon.

@authentik-automation
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@authentik-automation authentik-automation bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant