Spring Oauth2.0 缺少授权类型 [英] Spring Oauth2.0 Missing grant type

查看:30
本文介绍了Spring Oauth2.0 缺少授权类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Spring Oauth 2.O.

I am using Spring Oauth 2.O.

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

When I pass request as a form-data it works fine, but when I try to pass data in application/json format it gives me error missing grant type.

请求

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

OAuth2 doesn't support JSON in the access token request.You can check here for description..It requires application/x-www-form-urlencoded

这篇关于Spring Oauth2.0 缺少授权类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆