Openid support in 0.3.6 - solved #1401

Closed
opened 2025-11-11 14:44:21 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @T-Herrmann-WI on GitHub (Jun 29, 2024).

Bug Report

I tested the new open-webui:0.3.6 with openid support.

Docu: https://docs.openwebui.com/tutorial/sso/

Docker Compose FIle:

environment:
- OAUTH_CLIENT_ID=xxxxxxxxxxx
- OAUTH_CLIENT_SECRET=xxxxxxxxxxxx
- OPENID_PROVIDER_URL=https://domain/auth/realms/""Relam""/.well-known/openid-configuration
- OAUTH_PROVIDER_NAME=Keycloak
- OAUTH_SCOPES=

Get the error >>> KeyError: 'userinfo' UserInfo = token["userinfo"]

I guess I do something wrong by the scope.

Environment

  • Open WebUI Version: 0.3.6

Logs and Screenshots

NFO:     89.14.165.50:0 - "GET /oauth/oidc/callback?state=tJRmNbMLY0LMuaMc9hFlpaxz4TaV2P&session_state=f60c6e62-4170-4a05-8fc9-15df062542f2&code=7c2e0aa9-0680-4cdb-8536-b266e0d3415d.f60c6e62-4170-4a05-8fc9-15df062542f2.5f683213-517f-4858-acd9-6086beee869e HTTP/1.1" 500 Internal Server Error
ERROR:    Exception in ASGI application
  + Exception Group Traceback (most recent call last):
  |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups
  |     yield
  |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in call
  |     async with anyio.create_task_group() as task_group:
  |   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in aexit
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi
    |     result = await app(  # type: ignore[func-returns-value]
    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in call
    |     return await self.app(scope, receive, send)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in call
    |     await super().call(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in call
    |     await self.middleware_stack(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in call
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in call
    |     await self.app(scope, receive, _send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/sessions.py", line 85, in call
    |     await self.app(scope, receive, send_wrapper)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 804, in update_embedding_function
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 795, in check_url
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in call
    |     await self.app(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 768, in dispatch
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in call
    |     with collapse_excgroups():
    |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in exit
    |     self.gen.throw(typ, value, traceback)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in call
    |     response = await self.dispatch_func(request, call_next)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 624, in dispatch
    |     response = await call_next(request)
    |                ^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next
    |     raise app_exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro
    |     await self.app(scope, receive_or_disconnect, send_no_error)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in call
    |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in call
    |     await self.middleware_stack(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app
    |     await route.handle(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle
    |     await self.app(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app
    |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    |     raise exc
    |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    |     await app(scope, receive, sender)
    |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app
    |     response = await func(request)
    |                ^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app
    |     raw_response = await run_endpoint_function(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    |     return await dependant.call(**values)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/backend/main.py", line 1894, in oauth_callback
    |     user_data: UserInfo = token["userinfo"]
    |                           ~~~~~^^^^^^^^^^^^
    | KeyError: 'userinfo'
    +------------------------------------
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
Browser Console Logs:
Internal Server Error

Docker Container Logs:
[Include relevant Docker container logs, if applicable]

Originally created by @T-Herrmann-WI on GitHub (Jun 29, 2024). # Bug Report I tested the new open-webui:0.3.6 with openid support. Docu: https://docs.openwebui.com/tutorial/sso/ Docker Compose FIle: environment: - OAUTH_CLIENT_ID=xxxxxxxxxxx - OAUTH_CLIENT_SECRET=xxxxxxxxxxxx - OPENID_PROVIDER_URL=https://domain/auth/realms/""Relam""/.well-known/openid-configuration - OAUTH_PROVIDER_NAME=Keycloak - OAUTH_SCOPES= Get the error >>> KeyError: 'userinfo' UserInfo = token["userinfo"] I guess I do something wrong by the scope. ## Environment - **Open WebUI Version:** 0.3.6 ## Logs and Screenshots NFO:     89.14.165.50:0 - "GET /oauth/oidc/callback?state=tJRmNbMLY0LMuaMc9hFlpaxz4TaV2P&session_state=f60c6e62-4170-4a05-8fc9-15df062542f2&code=7c2e0aa9-0680-4cdb-8536-b266e0d3415d.f60c6e62-4170-4a05-8fc9-15df062542f2.5f683213-517f-4858-acd9-6086beee869e HTTP/1.1" 500 Internal Server Error ERROR:    Exception in ASGI application   + Exception Group Traceback (most recent call last):   |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 87, in collapse_excgroups   |     yield   |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 190, in __call__   |     async with anyio.create_task_group() as task_group:   |   File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 680, in __aexit__   |     raise BaseExceptionGroup(   | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)   +-+---------------- 1 ----------------     | Traceback (most recent call last):     |   File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 435, in run_asgi     |     result = await app(  # type: ignore[func-returns-value]     |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__     |     return await self.app(scope, receive, send)     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__     |     await super().__call__(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__     |     await self.middleware_stack(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__     |     await self.app(scope, receive, _send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/sessions.py", line 85, in __call__     |     await self.app(scope, receive, send_wrapper)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__     |     with collapse_excgroups():     |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__     |     self.gen.throw(typ, value, traceback)     |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__     |     response = await self.dispatch_func(request, call_next)     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/app/backend/main.py", line 804, in update_embedding_function     |     response = await call_next(request)     |                ^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next     |     raise app_exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro     |     await self.app(scope, receive_or_disconnect, send_no_error)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__     |     with collapse_excgroups():     |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__     |     self.gen.throw(typ, value, traceback)     |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__     |     response = await self.dispatch_func(request, call_next)     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/app/backend/main.py", line 795, in check_url     |     response = await call_next(request)     |                ^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next     |     raise app_exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro     |     await self.app(scope, receive_or_disconnect, send_no_error)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__     |     await self.app(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__     |     with collapse_excgroups():     |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__     |     self.gen.throw(typ, value, traceback)     |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__     |     response = await self.dispatch_func(request, call_next)     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/app/backend/main.py", line 768, in dispatch     |     response = await call_next(request)     |                ^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next     |     raise app_exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro     |     await self.app(scope, receive_or_disconnect, send_no_error)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 189, in __call__     |     with collapse_excgroups():     |   File "/usr/local/lib/python3.11/contextlib.py", line 158, in __exit__     |     self.gen.throw(typ, value, traceback)     |   File "/usr/local/lib/python3.11/site-packages/starlette/_utils.py", line 93, in collapse_excgroups     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 191, in __call__     |     response = await self.dispatch_func(request, call_next)     |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/app/backend/main.py", line 624, in dispatch     |     response = await call_next(request)     |                ^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 165, in call_next     |     raise app_exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/base.py", line 151, in coro     |     await self.app(scope, receive_or_disconnect, send_no_error)     |   File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 65, in __call__     |     await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app     |     await app(scope, receive, sender)     |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 756, in __call__     |     await self.middleware_stack(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 776, in app     |     await route.handle(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 297, in handle     |     await self.app(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 77, in app     |     await wrap_app_handling_exceptions(app, request)(scope, receive, send)     |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app     |     raise exc     |   File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app     |     await app(scope, receive, sender)     |   File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 72, in app     |     response = await func(request)     |                ^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 278, in app     |     raw_response = await run_endpoint_function(     |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function     |     return await dependant.call(**values)     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^     |   File "/app/backend/main.py", line 1894, in oauth_callback     |     user_data: UserInfo = token["userinfo"]     |                           ~~~~~^^^^^^^^^^^^     | KeyError: 'userinfo'     +------------------------------------ During handling of the above exception, another exception occurred: Traceback (most recent call last): **Browser Console Logs:** Internal Server Error **Docker Container Logs:** [Include relevant Docker container logs, if applicable]
Author
Owner

@T-Herrmann-WI commented on GitHub (Jun 29, 2024):

I solved the problem. I forgot to add ENABLE_OAUTH_SIGNUP=true
Sorry my mistake.

environment:

@T-Herrmann-WI commented on GitHub (Jun 29, 2024): I solved the problem. I forgot to add ENABLE_OAUTH_SIGNUP=true Sorry my mistake. environment: - ENABLE_OAUTH_SIGNUP=true - OAUTH_CLIENT_ID=xxxxxxxxxxx - OAUTH_CLIENT_SECRET=xxxxxxxxxxxx - OPENID_PROVIDER_URL=[https://domain/auth/realms/""Relam""/.well-known/openid-configuration](https://domain/auth/realms/%22%22Relam%22%22/.well-known/openid-configuration) - OAUTH_PROVIDER_NAME=Keycloak - OAUTH_SCOPES=
Author
Owner

@lei1402 commented on GitHub (Jul 2, 2024):

@T-Herrmann-WI HI,Are you using a keycloak? Can you refer to your docker-compose?

@lei1402 commented on GitHub (Jul 2, 2024): @T-Herrmann-WI HI,Are you using a keycloak? Can you refer to your docker-compose?
Author
Owner

@T-Herrmann-WI commented on GitHub (Jul 2, 2024):

From the Keycloak or Ollama Stack?

@T-Herrmann-WI commented on GitHub (Jul 2, 2024): From the Keycloak or Ollama Stack?
Author
Owner

@AlbertoManuel07 commented on GitHub (Jul 12, 2024):

Could you share us how to implement Keycloak?

@AlbertoManuel07 commented on GitHub (Jul 12, 2024): Could you share us how to implement Keycloak?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#1401