Oauth2 "Invalid grant_type parameter value" error when requesting access token using Password Grant Type | Community
Skip to main content
Level 2
October 5, 2023

Oauth2 "Invalid grant_type parameter value" error when requesting access token using Password Grant Type

  • October 5, 2023
  • 1 reply
  • 1855 views

Hello,

 

I'm trying to get access token using Password Grant Type:

 

curl --location --request POST 'http://<HOST>:<PORT>/oauth/token?username=<USERNAME>&password=<PASSWORD>&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&grant_type=password&redirect_uri=<REDIRECT_URI>' --header 'Content-Type: application/x-www-form-urlencoded'

 

 

However, that results in the following error:

 

{"error_description":"Invalid grant_type parameter value","error":"invalid_request"}curl: (18) transfer closed with outstanding read data remaining

 

 

AEM ver is 6.5

 

Any help appreaciated.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

aanchal-sikka
Community Advisor
Community Advisor
October 6, 2023

Hello @dwid1 

 

Please try with following grant_type:

client_credentials

refresh_token

authorization_code

Aanchal Sikka
dwid1Author
Level 2
October 6, 2023

Hello @aanchal-sikka

I cannot use refresh_token / authorization_code as they do not exchange the user’s username and password for an access token.

 

These are the grant types to exchange the user’s username and password for an access token:
https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ or 
https://www.oauth.com/oauth2-servers/access-tokens/password-grant/

 

However, both the grant types:
password,
client_credentials

result in the same error:

 

{"error_description":"Invalid grant_type parameter value","error":"invalid_request"}curl: (18) transfer closed with outstanding read data remaining