问题描述
我正在尝试从 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调用而不是密码吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)