35
Views
4
Comments
Error grant_type when consume api
Question

I am consuming REST APi as below but I receive error.

Error:
AADSTS900144: The request body must contain the following parameter: 'grant_type'. 


REST API:


Input:


Service Centre Error Log:

UserImage.jpg
Alexandre Yip

Hi Muhammad Faiq Roslan, 

The parameter should be set with 

grant_type=client_credentials

Check out here 

https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/

and this article 

https://itnext.io/getting-started-with-outsystems-and-microsoft-graph-123006356d41

Regards 


UserImage.jpg
Muhammad Faiq Roslan

no, 'authorization_code' is also one of the input for grant_type other than client credential. It work when in postman and in service studio but not when run it on browser.

2019-01-07 16-04-16
Siya
 
MVP

Please enable Full logging and see what is actually sent to the server.  ( Service Center -> Factory -> Module -> Integrations -> Consumed REST APIs -> Logging Level = Full. ). 

2023-01-19 12-23-07
Abhinav Shilwant

Hi @Muhammad Faiq Roslan,

The error you’re encountering (AADSTS900144: The request body must contain the following parameter: 'grant_type') typically occurs when the OAuth2 token request is missing the grant_type parameter.

Steps to Resolve:

1) Ensure grant_type is included: When consuming the API, make sure the request body includes the grant_type parameter. This could be one of the following based on your flow:

grant_type=client_credentials

grant_type=password

grant_type=authorization_code

2) Check API Request Body: In OutSystems, ensure you’re passing the correct parameters in the request body when making the API call. You can do this in the Request Body of the Consume REST API action.

3) Verify Headers: Ensure that the necessary headers (like Content-Type: application/x-www-form-urlencoded) are also correctly set.

4) Review Logs: Check the error logs in Service Center to verify if the request is correctly formatted and if other required parameters are missing.

Let me know if you need more help with the request setup!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.