diff --git a/docs/my-website/docs/proxy/ui.md b/docs/my-website/docs/proxy/ui.md index 13f975cd19..1c1931f8f8 100644 --- a/docs/my-website/docs/proxy/ui.md +++ b/docs/my-website/docs/proxy/ui.md @@ -133,6 +133,8 @@ The following can be used to customize attribute names when interacting with the GENERIC_USER_ID_ATTRIBUTE = "given_name" GENERIC_USER_EMAIL_ATTRIBUTE = "family_name" GENERIC_USER_ROLE_ATTRIBUTE = "given_role" + +GENERIC_SCOPE = "openid profile email" # default scope openid is sometimes not enough to retrieve basic user info like first_name and last_name located in profile scope ``` - Set Redirect URI, if your provider requires it diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py index b307852b4e..37f55072e5 100644 --- a/litellm/proxy/proxy_server.py +++ b/litellm/proxy/proxy_server.py @@ -4565,6 +4565,7 @@ async def google_login(request: Request): from fastapi_sso.sso.generic import create_provider, DiscoveryDocument generic_client_secret = os.getenv("GENERIC_CLIENT_SECRET", None) + generic_scope = os.getenv("GENERIC_SCOPE", "openid email profile").split(" ") generic_authorization_endpoint = os.getenv( "GENERIC_AUTHORIZATION_ENDPOINT", None ) @@ -4615,6 +4616,7 @@ async def google_login(request: Request): client_secret=generic_client_secret, redirect_uri=redirect_url, allow_insecure_http=True, + scope=generic_scope, ) with generic_sso: return await generic_sso.get_login_redirect() @@ -4765,6 +4767,7 @@ async def auth_callback(request: Request): from fastapi_sso.sso.generic import create_provider, DiscoveryDocument generic_client_secret = os.getenv("GENERIC_CLIENT_SECRET", None) + generic_scope = os.getenv("GENERIC_SCOPE", "openid email profile").split(" ") generic_authorization_endpoint = os.getenv( "GENERIC_AUTHORIZATION_ENDPOINT", None ) @@ -4815,6 +4818,7 @@ async def auth_callback(request: Request): client_secret=generic_client_secret, redirect_uri=redirect_url, allow_insecure_http=True, + scope=generic_scope, ) verbose_proxy_logger.debug(f"calling generic_sso.verify_and_process") request_body = await request.body()