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:
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
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.
Please enable Full logging and see what is actually sent to the server. ( Service Center -> Factory -> Module -> Integrations -> Consumed REST APIs -> Logging Level = Full. ).
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=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!