【问题标题】:Authenticate Jira Api in Java with personal API token使用个人 API 令牌在 Java 中验证 Jira Api
【发布时间】:2021-06-03 01:56:38
【问题描述】:

我正在尝试从 jira 检索问题。我能够使用用户名和密码得到响应。但随着密码不断变化,我想使用 api 令牌进行身份验证。但我做不到。 这是我的代码:

public class JiraMetrics {

private static final String JIRA_URL = "https://jira.company.com";
private static final String JIRA_USERNAME = "username";
private static final String JIRA_password = "password";

     public static  void main(String[] args) throws URISyntaxException {




    JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

    URI uri = new URI(JIRA_URL);
    JiraRestClient client = factory.createWithBasicHttpAuthentication(uri,JIRA_USERNAME,JIRA_Password);



    //Calling issues
    Promise<SearchResult> searchJqlPromise = client.getSearchClient().searchJql("query");

    for (Issue issue : searchJqlPromise.claim().getIssues()) {
        System.out.println(issue.getKey());
      
    }

   }

不用密码,我们可以直接使用 api token 调用吗?

【问题讨论】:

标签: java jira-rest-api jira-rest-java-api


【解决方案1】:

你必须:

【讨论】:

    猜你喜欢
    • 2016-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-06
    • 2014-06-14
    • 1970-01-01
    • 1970-01-01
    • 2017-02-11
    相关资源
    最近更新 更多