13

I am using Spring Oauth 2.O.

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.

Request

http://localhost:8080/oauth/token

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

Error I getting.

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

Please Guide.

Tom11
  • 2,419
  • 8
  • 30
  • 56
Parth Solanki
  • 3,268
  • 2
  • 22
  • 41

2 Answers2

32

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

Community
  • 1
  • 1
Prasanna Kumar H A
  • 3,341
  • 6
  • 24
  • 52
-1

Additionally to Prasanna Kumar I want to add that you need to send your data in body of application/x-www-form-urlencoded type like KEY-VALUE
Grant types you can check here

Evan
  • 31
  • 2