Hello everyone,
I am consuming the Microsoft Azure AD token Rest API, but whenever I test the rest API in Outsystems then I get this error. I can't specify why it throws this error "invalid_request". Can anyone help me resolve this problem.
Thanks,
Hi,
The endpoint you have specified in your request is the OAuth Token Endpoint Url of the Microsoft Identity Platform. The token endpoint is responsible for the following operations
Exchanging a grant
You can get an access token via the following grant_types
The token endpoint url accepts POST requests via application/x-www-form-urlencoded content type.
For requesting an access token by client credentials you have to provide the following parameters.
The body of the request would look like the following
grant_type=client_credentials&client_id={ClientId}&client_secret={ClientSecret}&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
Note: Scope must be URL encoded!
After a successful request you will receive an access_token and expires_in along with a token_type (always Bearer).
Best
Stefan
Thankyou @Stefan Weber it works now.
Hi Rakhi Singh,
Hope you are doing well.
Check the error details, seems like the Rest API is POST method and request body must contain the following parameters. In screenshot request body is empty. Provide some parameters and then verify. Hope this helps.
Regards,
Shubham
Hi,I already try that whatever you are saying but it does not work.
Thanks
Hello Rakhi,
Based on the error description it looks like you are missing something or sending request parameters incorrectly. You may need to pass "Grant_Type" into the request. Can you please validate all your request parameters or try with postman?
Sachin
Hi
I tried all the parameters with postman and there it works fine, but it throws error in outsystems.
Please see this post.
https://www.outsystems.com/forums/discussion/61594/consume-rest-api-parameters-not-send-in-the-body-http-400-bad-request/