{"record":{"id":"8970c5ba5c44253c","repo":"BerriAI/litellm","slug":"oauth-token-info-endpoint-environment-variable-is","errorCode":null,"errorMessage":"OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set","messagePattern":"OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/auth/oauth2_check.py","lineNumber":149,"sourceCode":"        if premium_user is not True:\n            raise ValueError(\n                \"Oauth2 token validation is only available for premium users\" + CommonProxyErrors.not_premium_user.value\n            )\n\n        verbose_proxy_logger.debug(\"Oauth2 token validation for token=[set=%s]\", token is not None)\n\n        # Get the token info endpoint from environment variable\n        token_info_endpoint: Final = os.getenv(\"OAUTH_TOKEN_INFO_ENDPOINT\")\n        user_id_field_name: Final = os.environ.get(\"OAUTH_USER_ID_FIELD_NAME\", \"sub\")\n        user_role_field_name: Final = os.environ.get(\"OAUTH_USER_ROLE_FIELD_NAME\", \"role\")\n        user_team_id_field_name: Final = os.environ.get(\"OAUTH_USER_TEAM_ID_FIELD_NAME\", \"team_id\")\n\n        # OAuth2 client credentials for introspection endpoint authentication\n        oauth_client_id: Final = os.environ.get(\"OAUTH_CLIENT_ID\")\n        oauth_client_secret: Final = os.environ.get(\"OAUTH_CLIENT_SECRET\")\n\n        if not token_info_endpoint:\n            raise ValueError(\"OAUTH_TOKEN_INFO_ENDPOINT environment variable is not set\")\n\n        client: Final = get_async_httpx_client(llm_provider=httpxSpecialProvider.Oauth2Check)\n\n        # Determine if this is an introspection endpoint (requires POST) or token info endpoint (uses GET)\n        is_introspection_endpoint: Final = Oauth2Handler._is_introspection_endpoint(\n            token_info_endpoint=token_info_endpoint,\n            oauth_client_id=oauth_client_id,\n            oauth_client_secret=oauth_client_secret,\n        )\n\n        try:\n            if is_introspection_endpoint:\n                # OAuth2 Token Introspection (RFC 7662) - requires POST with form data\n                verbose_proxy_logger.debug(\"Using OAuth2 introspection endpoint (POST)\")\n\n                headers, data = Oauth2Handler._prepare_introspection_request(\n                    token=token,\n                    oauth_client_id=oauth_client_id,","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/auth/oauth2_check.py#L131-L167","documentation":"Oauth2 token validation needs the token-info introspection endpoint URL from OAUTH_TOKEN_INFO_ENDPOINT; the premium gate passed but the deployment never configured where to introspect tokens, so validation cannot run.","triggerScenarios":"Thrown at litellm/proxy/auth/oauth2_check.py:149 when the library encounters an invalid state.","commonSituations":"OAuth2 token validation is enabled but the token info endpoint env var is missing.","solutions":["Set the OAUTH_TOKEN_INFO_ENDPOINT environment variable to your provider's token introspection/userinfo endpoint."],"exampleFix":"export OAUTH_TOKEN_INFO_ENDPOINT=https://your-idp.example.com/oauth2/introspect","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}