Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira responding with 404 instead of 401 with basic authentication

Rick van Dam September 24, 2020

Iam working on a integration between Jira and Uptrends for our clients.

 

Now iam trying to authenticate to Jira using basic authentication from C#. However it seems that if I use the following code to get basic authentication working it responds with a 404:

CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(requestUri, "Basic", new NetworkCredential(username, password));

This seems to be caused by the fact that the Jira server does not send a 401 but a 404. Was this done on purpose? Is the only solution is to force the authorization headers to be send on the first request like so?

string encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password));
httpWebRequest.Headers.Add("Authorization", "Basic " + encoded);

 

1 answer

0 votes
Warren
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 24, 2020

Hi @Rick van Dam 

This may not be the only problem, but it will need to be resolved before you get the authentication working.

I notice that you're using (the variable) password, whereas for Jira cloud, you need to be using an API token - see this post for further details.

Rick van Dam September 24, 2020

Oh thats just a naming of the variable in my test setup to test this. I actually put a api token in there.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events