cancel
Showing results for 
Search instead for 
Did you mean: 

Using Network Credentials in BP Web API

SamuelEzeala
Level 2
Hi Guys, 
I am having difficulty calling an API on Blue Prism. the API uses network Credentials. In C#, the code below does the job for me, But am unable to archive same using the Web API Services on Blue Prism. 

Please is they any work around it, or do i have to write a custom object for this purpose?


Thanks.

    var _data = new Data();
    var userName = _username;
    var password = _password;

            
    var credentials = new NetworkCredential(userName, password);
    using (var httpClient = new HttpClient(new HttpClientHandler { Credentials = credentials }))
            {
              
                httpClient.DefaultRequestHeaders.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json;odata=verbose"));
                var response = await httpClient.GetAsync(endpointUrl2);

                if (response.IsSuccessStatusCode)
                {

                    string apiResponse = await response.Content.ReadAsStringAsync();
                    _data = JsonConvert.DeserializeObject<Data>(apiResponse);
                }
            }​


------------------------------
Samuel Ezeala
Software Engineer | RPA Developer
eProcess, Ecobank Group
Lagos, Nigeria
------------------------------
Samuel Ezeala Software Engineer | RPA Developer eProcess, Ecobank Group Lagos, Nigeria
10 REPLIES 10

Hi @Manish Rawat,

There's no way to perform NTLM authentication with the standard Web API Services feature. Web API only supports HTTP Basic, OAuth2, and Bearer (aka API Key). If the API you're calling only requires you to pass along an Authentication header with Bearer [TOKEN] as the value you could use the Microsoft Authentication Library (MSAL) VBO to perform an NTLM​ auth step, get the access token as a response, and then pass in that in with the Web API.

Cheers,

------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------