Login error redirect
When there is an error during the log in with LifeScience the user should be redirect regardless of the error.
A URL Query parameter an be attachted to the redirect URL to indicate to the Frontent that there has been an error.
Something like: /?error
Here is the log from the server during such an error
INFO: 172.20.0.3:50720 - "GET /auth/callback?error=access_denied&error_description=No+sub+retrieved+for+user&state=d4r61Pb07HigiguWILIQEuVn9uwV9u HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 366, in run_asgi
result = await app(self.scope, self.receive, self.send)
File "/usr/local/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
return await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/fastapi/applications.py", line 269, in __call__
await super().__call__(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/applications.py", line 124, in __call__
await self.middleware_stack(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 184, in __call__
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/errors.py", line 162, in __call__
await self.app(scope, receive, _send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/sessions.py", line 80, in __call__
await self.app(scope, receive, send_wrapper)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 24, in __call__
await responder(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/gzip.py", line 43, in __call__
await self.app(scope, receive, self.send_with_gzip)
File "/usr/local/lib/python3.10/site-packages/starlette/middleware/cors.py", line 84, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/exceptions.py", line 93, in __call__
raise exc
File "/usr/local/lib/python3.10/site-packages/starlette/exceptions.py", line 82, in __call__
await self.app(scope, receive, sender)
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 21, in __call__
raise e
File "/usr/local/lib/python3.10/site-packages/fastapi/middleware/asyncexitstack.py", line 18, in __call__
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 670, in __call__
await route.handle(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 266, in handle
await self.app(scope, receive, send)
File "/usr/local/lib/python3.10/site-packages/starlette/routing.py", line 65, in app
response = await func(request)
File "/usr/local/lib/python3.10/site-packages/fastapi/routing.py", line 217, in app
solved_result = await solve_dependencies(
File "/usr/local/lib/python3.10/site-packages/fastapi/dependencies/utils.py", line 529, in solve_dependencies
solved = await call(**sub_values)
File "/code/./app/api/dependencies.py", line 227, in get_userinfo_from_access_token
claims = await oauth.lifescience.authorize_access_token(request)
File "/usr/local/lib/python3.10/site-packages/authlib/integrations/starlette_client/apps.py", line 60, in authorize_access_token
raise OAuthError(error=error, description=description)
authlib.integrations.base_client.errors.OAuthError: access_denied: No sub retrieved for user