{"record":{"id":"7b54469d7f376aff","repo":"BerriAI/litellm","slug":"oauth2-token-validation-is-only-available-for-prem","errorCode":null,"errorMessage":"Oauth2 token validation is only available for premium usersYou must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. \nPricing: https://www.litellm.ai/#pricing","messagePattern":"Oauth2 token validation is only available for premium usersYou must be a LiteLLM Enterprise user to use this feature\\. If you have a license please set `LITELLM_LICENSE` in your env\\. Get a 7 day trial key here: https://www\\.litellm\\.ai/enterprise#trial\\. \nPricing: https://www\\.litellm\\.ai/#pricing","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/auth/oauth2_check.py","lineNumber":132,"sourceCode":"        \"\"\"\n        Makes a request to the token introspection endpoint to validate the OAuth2 token.\n\n        This function implements OAuth2 token introspection according to RFC 7662.\n        It supports both generic token info endpoints (GET) and OAuth2 introspection endpoints (POST).\n\n        Args:\n            token (str): The OAuth2 token to validate.\n\n        Returns:\n            UserAPIKeyAuth: If the token is valid, containing user information.\n\n        Raises:\n            ValueError: If the token is invalid, the request fails, or the token info endpoint is not set.\n        \"\"\"\n        from litellm.proxy.proxy_server import premium_user\n\n        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","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/auth/oauth2_check.py#L114-L150","documentation":"Error \"Oauth2 token validation is only available for premium usersYou must be a LiteLLM Enterprise user to use this feature. If you have a license please set `LITELLM_LICENSE` in your env. Get a 7 day trial key here: https://www.litellm.ai/enterprise#trial. \nPricing: https://www.litellm.ai/#pricing\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/auth/oauth2_check.py:132 when the library encounters an invalid state.","commonSituations":"OAuth2 token validation was configured on a proxy running without a LiteLLM Enterprise license.","solutions":["Set the LITELLM_LICENSE environment variable to your LiteLLM Enterprise license key.","Obtain a 7-day trial key at https://www.litellm.ai/enterprise#trial and set it as LITELLM_LICENSE.","Remove OAuth2 token validation config if you do not have an Enterprise license."],"exampleFix":"export LITELLM_LICENSE=<your-enterprise-key>","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-14T05:17:10.506Z"}