11-18-2020 02:18 AM
Hi,
I'm a developer and trying to make a toolbox to the automation software UiPath. It's peraty easy to make the activitys in general, but when it comes to the Authentication part is't a litle deficient.
When I look at the Hyland REST API Portal there are no examels on how. There are only a note that it's a http bearer method, and the method is fine but how to get the bearer key?
I hope there are some one here there are smartre then me. I can't find the way to get the key 🙂
In advance thanks for your help!
11-18-2020 06:41 AM
Heine,
In order to generate a bearer token you need to call the https://localhost/identityprovider/connect/token endpoint.
In the body, you need to pass the grant_type that is being used from IdP, the client_id, tenant, scope, and authentication credentials.
NOTE: For the longest time we didn't know we had to pass scope which by default is equal to evolution.
04-01-2021 10:28 AM
Hi Darren, a couple of thoughts/ideas. First check in Diagnostics Console to see if there is any additional messages logged there that may help. But one item to try would be to use "idp-tenant" for the last property instead of just "tenant" this may be different in your version from the Tech Quest class.
If you still have issues I would double check some of the values to make sure that they match what is configured on the client, just in case (scope, client_id, client_secret)
04-01-2021 10:50 AM
I just figured it out. I had to change the source code to this.
HttpContent content = new FormUrlEncodedContent(
new List<KeyValuePair<string, string>>()
{
new KeyValuePair<string, string>("grant_type",properties.GrantType),
new KeyValuePair<string, string>("username",properties.Username),
new KeyValuePair<string, string>("password",properties.Password),
new KeyValuePair<string, string>("scope",properties.Scope),
new KeyValuePair<string, string>("client_id",properties.ClientID),
new KeyValuePair<string, string>("client_secret",properties.ClientSecret),
new KeyValuePair<string, string>("tenant",properties.Tenant),
}
);
content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
content.Headers.ContentType.CharSet = "UTF-8";
try
{
using (HttpResponseMessage response = IdpClient.PostAsync(IdpClient.BaseAddress.ToString(), content).Result)
{
string responseBody = response?.Content?.ReadAsStringAsync().Result;
accessToken = JObject.Parse(responseBody)["access_token"]?.ToString();
}
}
catch (Exception ex)
{
throw new InvalidOperationException("Could not get response from IDP", ex);
}
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.