Re: Problem with HTTPPost in XPA3.3
Govert Schipper
Hi Graham,
Maybe you already solved this issue by yourself, but I ran into the same problem and solved it by setting the Content type of the blob variable used for the payload to ANSI instead of the default Binary.
Regards, Govert Schipper
Van: Graham White
Hi,
I am trying to obtain a token for MS Graph using HTTPPost but running into trouble. This curl command works fine and I am returned a valid token
curl -k -X POST -d "grant_type=client_credentials&client_id={OUR_CLIENT_ID}&client_secret={OURCLIENTSECRET}&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default" "https://login.microsoftonline.com/{OURCLIENTTOKEN}/oauth2/token"
In XPA I create a blob (Call it XX) and initialise it with 'grant_type=client_credentials&client_id={OURCLIENTID}&client_secret={OURCLIENTSECRET}&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default'
I then do the following
HTTPPost('https://login.microsoftonline.com/4ff5564d-e84c-4023-9a9f-489e06d4ab18/oauth2/token',XX,'Content-Type: application/x-www-form-urlencoded','')
"error": "invalid_request", "error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: 788e0f00-751e-402e-a5fc-6f1645bfbf00\r\nCorrelation ID: 3ac34f6d-6edf-40ef-b53d-5666f886e93c\r\nTimestamp: 2021-05-11 23:03:59Z", "error_codes": [ 900144 ], "timestamp": "2021-05-11 23:03:59Z", "trace_id": "788e0f00-751e-402e-a5fc-6f1645bfbf00", "correlation_id": "3ac34f6d-6edf-40ef-b53d-5666f886e93c", "error_uri": "https://login.microsoftonline.com/error?code=900144"
Regards Graham White
|
|