Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 21:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×I've been using those library for a year and it was fine. Approx. 1 or 2 weeks ago it stoped to work.
POM
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-rest-java-client-core</artifactId>
<version>5.1.2-2bd0a62e</version>
</dependency>
<dependency>
<groupId>io.atlassian.fugue</groupId>
<artifactId>fugue</artifactId>
<version>4.7.2</version>
<scope>provided</scope>
</dependency>
Java
BasicIssue task = jiraRestClient.getIssueClient().createIssue(taskBuilder.build()).claim();
Server respond with
com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 10 of
<html>
<head>
<title>Unauthorized (401)</title>
<!--[if IE]><![endif]-->
<script type="text/javascript" >
var contextPath = '';
var DeferScripts = { deferState: 'disabled' };
</script>
<script>
....
com.atlassian.jira.rest.client.internal.async.DelegatingPromise.claim(DelegatingPromise.java:45) ~[jira-rest-java-client-core-5.1.2-2bd0a62e.jar:na]
at com.smoope.utils.testcasegenerator.TestCaseGeneratorApplication.run(TestCaseGeneratorApplication.java:77) [classes/:na]
at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:790) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:774) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:335) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1234) [spring-boot-2.0.0.RELEASE.jar:2.0.0.RELEASE]
at TestCaseGeneratorApplication.main(TestCaseGeneratorApplication.java:46) [classes/:na]
Caused by: com.atlassian.jira.rest.client.api.RestClientException: org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 10 of
Hi Victor,
Basic authentication with passwords and cookie-based authentication are now deprecated and disabled.
"The deprecation period for this functionality has ended. From June 3rd, 2019, we will be progressively disabling the usage of this authentication method" - https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-basic-auth-and-cookie-based-auth/
You can use Basic Authentication with tokens instead of credentials.
So what java library should we use instead? I suppose we need to write our own `AuthenticationHandler` to implement the new way of doing things.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ben,
It seems you just need to use API token instead of password.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I used the API Token too but I have the same error. Using jira-rest-java-client-core v 5.2.4
Is there something that I can do to solve it?
private JiraRestClient getJiraRestClient() {
BasicHttpAuthenticationHandler authenticationHandler = new BasicHttpAuthenticationHandler(this.username, this.password);
return new AsynchronousJiraRestClientFactory().createWithAuthenticationHandler(getJiraUri(), authenticationHandler);
}
private URI getJiraUri() {
return URI.create(this.jiraUrl);
}
where I use the api-token instead of the password. But It does not work
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
---
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.