繁体   English   中英

Spring Oauth2.0 缺少授权类型

[英]Spring Oauth2.0 Missing grant type

我正在使用 Spring Oauth 2.O。

当我将请求作为表单数据传递时,它工作正常,但是当我尝试以application/json格式传递数据时,它会出现缺少授权类型的错误。

请求

http://localhost:8080/oauth/token

{"username":"parths","password":"123456","grant_type":"password"}

我得到的错误。

{
  "status": "0",
  "message": "Missing grant type"
}

请指导。

OAuth2在访问令牌请求中不支持JSON 。您可以在此处查看说明..它需要application/x-www-form-urlencoded

除了 Prasanna Kumar,我想补充一点,您需要在application/x-www-form-urlencoded类型的正文中发送您的数据,例如 KEY-VALUE
您可以在此处查看赠款类型

暂无
暂无

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM