Rest API; Basic Auth Request works in postman but not HttpClient

Hello, everyone!

I am currently encountering a strange issue when trying to use the JIRA API and basic authentication.

I have made an http request that works successfully in postman and from my app in angularjs:

However, I have now tried to replicate this request in my c# code for my web api and the request never seems to work. Sending the request from here doesn’t reflect any use of the api token when checking my api tokens on the JIRA website.

I have replaced my base64encoded password here with $$$$ just for this post.

My response is always:

Why would this request be working in postman but not in my c# code with httpclient? I have tried re-writing this many different ways.

Hi @SpencerPoole, welcome to the dev community. First of all, glad that you’re able to make a call using Postman, meaning that your auth credentials and API call mechanics are spot on. As for your client/app side problem, I would recommend using Postman’s proxy or interceptor feature, which allows you to inspect the request and response details.

There are other tools you can use to put a MITM (man in the middle), but since you’re using Postman already, it’s a very cool tool to add to your belt for problems just like this, when you’re certain the request should work, but the request is failing.

For all requests captured, you’ll be able to inspect full request + response headers and bodies.

Hi @SpencerPoole,

In your first screenshot you’re using /rest/api/2/issue/MOBILE-2670. And in the second with the code it’s /rest/api/3/issue/MOBILE-2670.

The documentation for GET /rest/api/3/issue in

doesn’t mention a v2 endpoint.

Can you check your code and Postman calls are the same?