api auth_error ai_generated true

OAuth2 错误:未授权的客户端

OAuth2 error: unauthorized_client

ID: api/oauth2-unauthorized-client

其他格式: JSON · Markdown 中文 · English
90%修复率
85%置信度
1证据数
2024-03-15首次发现

版本兼容性

版本状态引入弃用备注
OAuth2 RFC 6749 active
OAuth2 RFC 6750 active

根因分析

OAuth2 令牌请求中提供的 client_id 或 client_secret 未注册,或该客户端被禁止使用请求的授权类型。

English

The client_id or client_secret provided in the OAuth2 token request is not registered or is disabled for the requested grant type.

generic

官方文档

https://datatracker.ietf.org/doc/html/rfc6749#section-5.2

解决方案

  1. 在 OAuth2 提供方的管理面板中验证 client_id 和 client_secret。确保客户端已启用且允许正确的授权类型(例如 authorization_code、client_credentials)。示例:curl -X POST https://auth.example.com/token -d 'grant_type=client_credentials&client_id=valid_client&client_secret=valid_secret'
  2. 查阅提供方的文档,确认是否需要指定的作用域或其他参数。添加缺失的作用域:POST /token 带上 scope=openid profile

无效尝试

常见但无效的做法:

  1. 40% 失败

    Regenerating the client_secret without updating the application configuration will not resolve the issue if the client_id is incorrect or the grant type is not allowed.

  2. 30% 失败

    Whitelisting the IP address of the client server does not address the root cause of an invalid client registration.