oAuth Setup


#1

Hi all
We are trying to set up the oAuth connection to Aspose.clouds but we keep getting this error message

{“error”:“unsupported_grant_type”}

We are using “grant_type”: “client_credentials” in our request (which is what the documentation says) so why would we be getting this error message?

Thanks


#2

@stephenbp

Thank you for contacting us.

Following cURL and Postman example should help you in identifying if you are setting any Header or Body parameter wrong:

cURL example to get Access Token
curl -v “https://api.aspose.cloud/oauth2/token
-X POST
-d ‘grant_type=client_credentials&client_id=0B17F60A-6D69-426B-9ABD-79F35A6E9F7B&client_secret=53b8b19adffa41a3e87dbbd8858977ae’
-H “Content-Type: application/x-www-form-urlencoded”
-H “Accept: application/json”

Postman Example
https://documenter.getpostman.com/view/2744137/RWTkSzEi


#3

Yes, I am using all those details. You can see the API request using all those example credentials here

https://apitester.com/shared/checks/ab226d773d8644fdb1e4cd2cbf1a3ae1

And I am getting the same error,

{“error”:“unsupported_grant_type”}


#4

@stephenbp

Post Data field is containing data in incorrect format. Please replace the following data:

{
"grant_type":"client_credentials",
"client_id":"0B17F60A-6D69-426B-9ABD-79F35A6E9F7B",
"client_secret":"53b8b19adffa41a3e87dbbd8858977ae"
}

with following:

grant_type=client_credentials&client_id=0B17F60A-6D69-426B-9ABD-79F35A6E9F7B&client_secret=53b8b19adffa41a3e87dbbd8858977ae

Please note the ampersand (&) sign and equal (=) operator.

Request in API Tester will look as follows:
https://apitester.com/shared/checks/11c7778b9218461286b545cdc5584f22

We hope this helps!


#5

Thanks. That worked perfectly.
Thank you for your quick replies.