REST API Authentication methods

Nir Haimov
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 11, 2018

Hi,

I have a plugin in Jira that i created.

Some of the functionality is, that i use HTTP requests (GET, PUT, POST) from Jira to Bitbucket and Bamboo.

For example:

public JSONObject checkForStgPrdDiff(String project, String repository, String from, String to) throws Exception {
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://stash.checkpoint.com/rest/api/1.0/projects/"+project+"/repos/"+repository+"/compare/commits?from="+from+"&to="+to+"&limit=10000")
.get()
.addHeader("authorization", "Basic " + myCredentials)
.addHeader("content-type", "application/json")
.build();

okhttp3.Response response = client.newCall(request).execute();
JSONObject jsonObject = new JSONObject(response.body().string());

return jsonObject;
}

 The things is, that i am not the only person in my company uses this plugin.

So by putting my credentials in the function, the other users get the data by login using my credentials (behind the scene).

Is there a way to perform HTTP request with authentication in a different way?

A way that will connect to Bitbucket and Bamboo using each user credentials and no my?

 

Thanks,

Nir 

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
July 11, 2018

Dear @Nir Haimov,

best you ask this question again on https://community.developer.atlassian.com/

So long

Thomas