Jira Service Desk API returning 401 from c# web application

This code was working and now it returns a 401 error (System.Net.HttpStatusCode.Unauthorized).

However, if I log into Jira and then open a new tab I can paste in the api call and poof, instant json response. So it appears that the credentials are correct.

I see that other people have this problem and then it starts working again, but that is not the case here. This is really a downer, because since it was working I have a really nice tableau report based on the results that I was saving to a database.

Any help would be appreciated.

-------

        var uriString = "https://journal.atlassian.net/rest/servicedeskapi/request?start=" + start.ToString() + "&limit=" + limit.ToString();
        var uri = new Uri(uriString);

        //var username = "my.email@someplace.com";
        //var password = "mypassword";

        var username = util.GetJiraAPIusername();
        var password = util.GetJiraAPIpassword();

        ViewBag.URI = uri;
        var client = new HttpClient();        client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:{password}")));        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        HttpResponseMessage response = client.GetAsync(uri).Result;  // Blocking call!
        if (response.IsSuccessStatusCode){ 

 

1 answer

This widget could not be displayed.

This doesn't necessarily solve the problem for me due to my vendor support, but Atlassian support provided this information. 

-------------------------------

User is a Service Desk portal user. There were changes not so long time ago where Service Desk portal user is not allowed not authenticate via REST API any more.

We are offering API tokens as an alternative for authentication. In order to make it work, your user should be converted to Atlassian Account first. These changes can be done by a site administrator of the Jira instance. Thus, you will need to contact them to clarify this question first.

The following article explains changes and instructions about what should be done, you can pass it to site administrator:
https://confluence.atlassian.com/cloudkb/jira-service-desk-cloud-rest-api-changes-to-atlassian-account-940700797.html

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 13, 2018 in Jira Service Desk

Jira Service Desk – Don’t be afraid, the journey begins with curiosity!

...be more productive while being fun to use at the same time. For some, getting started can be a bit intimidating. This is especially true if Jira Service Desk is your first exposure to Atlassian...

10,027 views 9 28
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you