简体   繁体   English

"error": "invalid_grant", "error_description": "错误的凭据"

[英]"error": "invalid_grant", "error_description": "Bad credentials"

I'm implementing Oauth2 in SpringBoot RestFul API.我正在 SpringBoot RestFul API 中实现Oauth2 Everything is working fine except when I use the wrong password getting error response:一切正常,除非我使用错误的密码获得错误响应:

Status : 400Bad Request状态:400Bad 请求

{
    "error": "invalid_grant",
    "error_description": "Bad credentials"
}

But I'm excepting like this:但我是这样的例外:

Status : 401 Unauthorized状态:401 未经授权

{
    "error": "unauthorized",
    "error_description": "Invalid username/password combination"
}

如果密码正确

After wrong password:密码错误后: 密码错误后

A 401 status would be returned if your authorization credentials are incorrect.如果您的授权凭据不正确,将返回401状态。 This would be your basic auth username and password (in Postman Authorization tab), which appears were unchanged.这将是您的基本身份验证用户名和密码(在 Postman Authorization 选项卡中),看起来没有改变。

A 400 status is returned because the validation of the request's body parameters (username, password) fails to find a match.由于请求的正文参数(用户名、密码)的验证未能找到匹配项,因此返回 400 状态。 (ie. Bad credentials were supplied.) It's like other requests where a required parameter is not submitted or formatted correctly. (即,提供了错误的凭据。)就像其他请求一样,所需的参数未提交或格式不正确。 Your request passes the oauth server's basic authorization for the login endpoint.您的请求通过了 oauth 服务器对登录端点的基本授权。 It would be confusing and incorrect if both scenarios returned a 401 status.如果这两种情况都返回 401 状态,那将是令人困惑和不正确的。400 status400 状态

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring oauth2 中的 error="invalid_grant", error_description="Bad credentials" - error="invalid_grant", error_description="Bad credentials" in Spring oauth2 Spring Boot: error="invalid_grant", error_description="Bad credentials" - Spring Boot: error=“invalid_grant”, error_description=“Bad credentials” 如何解决 google contact api 中的 { "error": "invalid_grant", "error_description": "Bad Request" } 问题 - How to resolve { "error" : "invalid_grant", "error_description" : "Bad Request" } issue in google contact api 从刷新令牌获取访问令牌失败并出现 invalid_grant 错误,并且错误请求或令牌已过期或作为错误描述被撤销 - Getting access token from refresh token failing with invalid_grant error, and Bad Request OR Token has been expired or revoked as error description invalid_grant:AADSTS50126:由于用户名或密码无效,验证凭据时出错 - invalid_grant: AADSTS50126: Error validating credentials due to invalid username or password 在bigquery中插入行时,com.google.aaaal 400 Bad Request {“error”:“invalid_grant”} - com.google.a.a.a.a.l 400 Bad Request { “error” : “invalid_grant” } while inserting row in bigquery Spring boot Oauth2 grant_type 密码总是返回 invalid_grant Bad Credentials - Spring boot Oauth2 grant_type password always return invalid_grant Bad Credentials {"error":"unsupported_grant_type","error_description":"不支持授权类型"} SalesForce Java - {"error":"unsupported_grant_type","error_description":"grant type not supported"} SalesForce Java Google Cloud Storage 和服务帐户的 invalid_grant 错误 - invalid_grant error with Google Cloud Storage and Service Account Gmail api 出现错误 400“invalid_grant” - Gmail api thows an error 400 "invalid_grant"
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM