diff --git a/loginpass/_fastapi.py b/loginpass/_fastapi.py index b18d72d..ef05920 100644 --- a/loginpass/_fastapi.py +++ b/loginpass/_fastapi.py @@ -18,7 +18,7 @@ def create_fastapi_routes(backends, oauth, handle_authorize): app.add_middleware(SessionMiddleware, secret_key=config.get("SECRET_KEY")) - def handle_authorize(remote, token, user_info, request): + async def handle_authorize(remote, token, user_info, request): return user_info router = create_fastapi_routes([GitHub, Google], oauth, handle_authorize) @@ -63,13 +63,13 @@ async def auth( token = await remote.authorize_access_token(request) else: # handle failed - return handle_authorize(remote, None, None) + return await handle_authorize(remote, None, None) if "id_token" in token: user_info = await remote.parse_id_token(request, token) else: remote.token = token user_info = await remote.userinfo(token=token) - return handle_authorize(remote, token, user_info, request) + return await handle_authorize(remote, token, user_info, request) @router.get("/login/{backend}") async def login(backend: str, request: Request):