cancel
Showing results for 
Search instead for 
Did you mean: 

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

JamesWilliams
Level 4

Good Morning,

I am attempting to put together an API call to generate a bearer token within Blue Prism Web API Services (I am using Blue Prism v6.10.5)

I am struggling to get the token to authorise and get the following message:

“Internal : Unexpected error Error during Web API HTTP Request

HTTP Status Code: 400

HTTP Response Content: {"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'grant_type'. Trace ID: 99479596-c3ae-4bb1-bcf8-e4ea321c0400 Correlation ID: f84f1d9d-e2d3-465e-a911-073a9a7c6e58 Timestamp: 2025-05-14 08:07:05Z","error_codes":[900144],"timestamp":"2025-05-14 08:07:05Z","trace_id":"99479596-c3ae-4bb1-bcf8-e4ea321c0400","correlation_id":"f84f1d9d-e2d3-465e-a911-073a9a7c6e58","error_uri":https://login.microsoftonline.com/error?code=900144}”

I have got this working in Postman without issue and wondered if you could offer some support in getting it working?

Here is a breakdown of the settings in Postman and Blue Prism:

Postman:

JamesWilliams_0-1747211411495.pngJamesWilliams_1-1747211527825.png

In postman it’s a very easy setup and the bearer token generates without issue

I have tried various things in Blue Prism but this is the latest setup

I am passing in the Parameters (I have also tried hard coding in the Service) to the action created by the Web API Services:

JamesWilliams_2-1747211672905.png

Inside the Web API Service:

JamesWilliams_3-1747211720515.png

Common Headers:

JamesWilliams_4-1747211720524.png

Common Parameters:

JamesWilliams_5-1747211720526.png

Common Authentication:

JamesWilliams_6-1747211720526.png

Common Code: (this is where the issue might be, Do I have to pass anything into this?)

JamesWilliams_7-1747211720528.png

The Action:

JamesWilliams_8-1747211720528.png

Parameters: ( I have tried the parameters that I am passing in, in here as well as mentioned above in the common parameters. I have tried to hard code them and pass them in from the calling process)

JamesWilliams_9-1747211720529.png

Request: (I have tried adding code to the Body Content but it didn't seem to work and I got compiler errors, code I tried looked like the following?

{

  "grant_type": "[grant_type]",

  "client_id": "[client_id]",

  "client_secret": "[client_secret]",

  "scope": "[scope]"

}

Also tried hard coding the values

JamesWilliams_10-1747211985505.png

Headers: (I tried adding Accept and Content Type here as well as the Common parameters above)

JamesWilliams_11-1747212016832.png

Response:

JamesWilliams_12-1747212016833.png

Any help is greatly appreciated

Thanks

 

 

 

 

1 BEST ANSWER

Helpful Answers

In the Generate Bearer Token Action:

  • Under Request > Headers, add a new header:
    Name: Content-Type
    Value: application/x-www-form-urlencoded
  • Under Request > Body, set:
    Body Type: Text
    Body Content Type: application/x-www-form-urlencoded
    Body Content (Template):
    grant_type=client_credentials&client_id=[Client_Id]&client_secret=[Client_Secret]&scope=[Scope]
    Ensure [Client_Id], [Client_Secret], and [Scope] are defined as input parameters and passed in from the calling process.

View answer in original post

2 REPLIES 2

In the Generate Bearer Token Action:

  • Under Request > Headers, add a new header:
    Name: Content-Type
    Value: application/x-www-form-urlencoded
  • Under Request > Body, set:
    Body Type: Text
    Body Content Type: application/x-www-form-urlencoded
    Body Content (Template):
    grant_type=client_credentials&client_id=[Client_Id]&client_secret=[Client_Secret]&scope=[Scope]
    Ensure [Client_Id], [Client_Secret], and [Scope] are defined as input parameters and passed in from the calling process.

Thank you for the response I have now got it working.