Acquire token REST API
Question
Application Type
Reactive
Service Studio Version
11.14.15 (Build 60242)

Hello,

I'm not very familiar with REST but I'm trying to use REST API methods to query Microsoft Graph .

I have copied REST API method 'GetToken' from the 'Microsoft Graph API' available in Forge . 

The values voor Tenant Id, Client Id and Client Secret have been tested in another way and are valid

Testing the method results in the response as shown in the screenshot.

Can anyone help me with this error?

Thanks in advance!

Erik

Outsystems Token aquisition.jpg

Hi, you are getting a 400 bad request, which usually happens when your request structure is incorrect and the server can't understand it (from my experience, you usually get a 400 when your request is badly written)


Reading further, it seems the problem is on the grant_type field, check again if you are supposed to pass what you are currently passing on that field, or if that field is expecting something else

Tell me if this helped!
Cheers,
Paulo

Hi Erik,

Try changing the content-type to "application/json" as currently you have "application/x-www-form-urlencoded" that means you should send data something as below.and its telling the web server that you will be encoding the parameters in the URL or send the parameters something like below

Name=John+Smith&Age=23

In your case you are sending a JSON in your body and thats why server its not able to understand the parameters and is throwing error 

"The request body must contain the following parameter: 'grant_type'"

Best Regards

Devendra



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