Posted: Wed Dec 30, 2020 10:39 am Post subject: Get Microsoft Oauth2 token in IIB
Acolyte
Joined: 12 Mar 2019 Posts: 57
Hi,
We are trying to get Ouath2 token from Microsoft in IIB using HTTP request node. But Microsoft Oauth2 token URL needs request in url encoded POST query string, in below format
POST /{tenant}/oauthv2.0/token HTTP/1.1
HOST: https://login.microsoft.com
Content-Type: application/x-www-form-urlencoded
grant_type=client_credentials&client_id=abc&client_secret=xyz&scope=abc
We are setting all the attributes in esql using query string like
Set OutputRoot.HTTPRequestHeader."Content-Type" = 'application/x-www-form-urlencoded';
Set OutputLocalEnvironment.Destination.HTTP.QueryString.grant_type = 'client_credentials';
All these parameters will be set as shown above, but when the post request is sent we are getting 400 bad request error saying grant_type is not specified for the request, which is a generic error when there is issue in query string.
So, is it right way to construct the url encoded string, or does the above esql set query parameter in the following format https://url?grant_type=client_credentials instead of POST request format shown above?
What you have done is correct however you also need to create a security profile with propogation set to yes and assign it as the security profile on the node.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum