Jira Rest API auth problem

I created a .Net Core API project and installed Atlassian.SDK 10.5.0.

Copied a sample code from the documentation for creating an issue:

var jira = Jira.CreateRestClient("http://myurl.atlassian.net", "email@address.com", "p@ssw0rd");
var issue = jira.CreateIssue("Test Project");
issue.Type = "Bug";
issue.Priority = "Major";
issue.Summary = "Issue Summary";
await issue.SaveChangesAsync();

When I run the code I receive an error message:

You are not authenticated. Authentication required to perform this operation.

When I run a ‘get issue’ example, it works even without username & password.

var jira = Jira.CreateRestClient("http://myurl.atlassian.net");
Issue issue = await jira.Issues.GetIssueAsync("XX-00");
return issue.Summary;

I tried my email address and the username (I found it in the csv export of all users) and both gave the same error message.

I think the reason this doesn’t work is because they are removing support for Basic authentication:

https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/

Using passwords with Jira REST API basic authentication
Support for passwords in REST API basic authentication is deprecated and will be removed in the future. While the Jira REST API currently accepts your Atlassian account password in basic auth requests, we strongly recommend that you use API tokens instead. We expect that support for passwords will be deprecated in the future and advise that all new integrations be created with API tokens.

So the documentation of the SDK is outdated.

Thanks

Somehow I am not surprised :grin:

1 Like