注:这些示例仅显示 JSON 响应。
客户端凭据不正确
如果您� 递的 client_id 和/或 client_secret 不正确,您将收到此错误响应。
{ "error": "incorrect_client_credentials", "error_description": "The client_id and/or client_secret passed are incorrect.", "error_uri": "/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#incorrect-client-credentials" } 要解决此错误,请确保您拥有 OAuth 应用程序 的正确凭据。 仔细检查 client_id 和 client_secret 以确保它们正确� 误并且正确地� 递到 GitHub Enterprise Server。
重定向 URI 不匹配
如果您提供的 redirect_uri 与您在 OAuth 应用程序 中注册的 URL 不匹配,您将收到此错误消息:
{ "error": "redirect_uri_mismatch", "error_description": "The redirect_uri MUST match the registered callback URL for this application.", "error_uri": "/apps/managing-oauth-apps/troubleshooting-authorization-request-errors/#redirect-uri-mismatch2" } 要更正此错误,请提供一个与您注册的 URL 匹配的 redirect_uri,或者忽略此参数以使用在应用程序中注册的默认 URL。
验证� �错误
{ "add_scopes": [ "repo" ], "note": "admin script" } 如果您� 递的验证� �不正确、已过期或与您在第一次授权请求中收到的验证� �不匹配,您将收到此错误。
{ "error": "bad_verification_code", "error_description": "The code passed is incorrect or expired.", "error_uri": "/apps/managing-oauth-apps/troubleshooting-oauth-app-access-token-request-errors/#bad-verification-code" } 要解决此错误,请再次启动 OAuth 授权流程并获取新代� �。