Respected Contributor.. relent0r Respected Contributor..
Respected Contributor..
785 views

azure authentication via 'HTTP Client POST' operation.

I'm trying to authenticate against the azure endpoint login.windows.net using the http client post operation but I'm unable to get it working correctly.

The request looks like this

URL : https://login.windows.net/${subscriptionid}/oauth2/token

Header : Content-Type: application/x-www-form-urlencoded, Accept: application/json

Body: grant_type=client_credentials&client_id=${client_id}&client_secret=${client_secret}&resource=${audiences}

Works fine in postman and returns a json response but I recieve a html form response when performing it with the http cllient post action.

/Base [1.10.0]/Library/Operations/HTTP Client/v2.0/Http Client Post

What I get when using the OO Action is a form response

 

<head>
<title>Continue</title>
</head>
<body>
<form method="POST" name="hiddenform" action="https://login.microsoftonline.com/*******************/oauth2/authorize">
<input type="hidden" name="grant_type" value="client_credentials" />
<input type="hidden" name="client_id" value="*****************************" />
<input type="hidden" name="client_secret" value="*********************" />
<input type="hidden" name="resource" value="https://adminmanagement.tenant.onmicrosoft.com/****************************" />
<noscript>
<p>Script is disabled. Click Submit to continue</p>
<input type="submit" value="Submit" />
</noscript>
</form>
<script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script>
</body>
</html>;reasonPhrase=OK;finalLocation=https://login.windows.net/***********************/oauth2/authorize;protocolVersion=HTTP/1.1;statusCode=200;Result=<html>

 

Any ideas on where I can go with this? I saw another person mention that they have to use a powershell rest invoke instead, but I'm doing this mainly to avoid using powershell.

 

edit : the cloud content pack has an auth operation but only supports username/password not applications for credentials.

0 Likes
2 Replies
Respected Contributor.. relent0r Respected Contributor..
Respected Contributor..

Re: azure authentication via 'HTTP Client POST' operation.

I foolishly didn't pay attention to the variable I was extracting from a previous subflow. I was supposed to be pulling the token_endpoint key not the authorization_endpoint key for the auth URL being used for my token generation. 

 

0 Likes
Micro Focus Expert
Micro Focus Expert

Re: azure authentication via 'HTTP Client POST' operation.

Hi relent0r,

We saw multiple users having issue with Microsoft API terminology, we'll raise this to them.

Can you explain why clientId is not working for your use case? I see no reason to not enable authentication with app id if this is very common use case.

Thanks,

Lucian

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.