NetworkCredential Equivalent in Postman

What is the equivalent Authentication for a NetworkCredential (C#) in Postman?

The code below works, I was just trying to replicate this C# code in Postman in calling the API, I’ve tried using Basic Auth and NTLM Auth, but didn’t work:

private async Task<HttpResponseMessage> PostAsync(string uri)
        {  
            //just sample dummy credential
            var user ="userA";
            var password ="123456";
            var domain = "DIR";
       
            string body = "[1]"; //some type needed for the api call

            var credentials = new NetworkCredential(user, password, domain);
            var handler = new HttpClientHandler { Credentials = credentials };
            using (var content = new StringContent(body, Encoding.UTF8, "application/json"))
            using (var client = new HttpClient(handler))
            {
                return await client.PostAsync(uri, content);
            }
        }

Sorry, just wanted to ask help here.

Hi @felrad.celest,

Welcome to the community! :clap:

No need to apologize for asking, we’re all here to help :slight_smile:

As for your question, I am not sure how to answer, as I havent worked with this in C# (though I have some experience with VB.NET web requests).

I took a look at Microsoft’s reference documents here:

So the example looks like they use Basic Authentication with your setup, though I know thats not necessarily right.

I suggest a couple things.

  1. Can you provide a screenshot of the response you get when you try using Basic Authentication, and NTML Auth? That can give us more clues as to where to go.

  2. Start up wireshark and run the C# code, and capture the packets of the authentication process. Here, you should get the raw http request, and it should give you clues as to how the authentication is being done with your C# app, and then we can apply that to Postman.

Number 2 is your best bet into figuring out what to do.

Let us know what you find!

Orest

Hi @felrad.celest,

I am faced with same challenge.

Have you been able to consume the API, with the network credentials on Postman?

Please share knowledge if you have.

Thank You,

@powerpoint01,

No, i was not able to replicate the Network Credentials in Postman. This still bugs me up to now.
I’ve look in StackOverflow, but there’s no post related to using NetworkCredential in Postman. I’ve also ask the same question there, but it got closed, so that’s why i posted here.