1

for the last week i'm trying to get an authentication key form the microsoft API. In postman this works. postman

But when i try the same call in rpgle code, using NOXDB as json tool. i get following response {"error":"invalid_request","error_description":"AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID

this is the webservice call, the variables are all filled up with the same value's as the one in postman

url = 'https://accounts.accesscontrol.windows.net/'+%trim(global.TenantID)+'/tokens/OAuth/2';
formvar = 'grant_type=refresh_token' + 
          '&client_id=' + %trim(global.clientid)+'@'+%trim(global.TenantID) + 
          '&client_secret=' + %trim(global.clientSecret) + 
          '&resource=' + %trim(global.ApplicationID)+'/'+
                       %trim(global.tenantName)+'.sharepoint.com@'+
                       %trim(global.TenantID) +
          '&refresh_token=' + %trim(global.RefreshToken);     
      
options = ('--H ''content-type: application/x-www-form-urlencoded'' -');
pResponse = json_httpRequest(%trim(url): formvar: options: 'TEXT');
hulp = Json_AsJsonText(pResponse);

what i think is going wrong is that i send a wrong format of form-data using the noxdb toolkit, but how should i be sending it?

thanks Wouter

WouterV
  • 133
  • 1
  • 11

0 Answers0