The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Authentication with bearer token

AbrahamA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
July 12, 2024

Hello

I am able to authenticate using Unirest library using email address and token.

Is it possible to just use bearer token and not have email address as part of authentication.

Postman authentication just uses bearer token to authenticate how can I do it using java program.

Please let me know.

The following program works using email and token.

package main;

import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.JsonNode;
import com.mashape.unirest.http.Unirest;

public class UniRestTest {

public static void main(String[] args) {

try {

HttpResponse<JsonNode> response = Unirest.get("https://xxx.atlassian.net/rest/api/3/issue/KAN-1")
.basicAuth("xxx@gmail.com", "ATATT3xFfGF00B16Long")
.header("Accept", "application/json")
.asJson();

System.out.println(response.getBody());

}catch(Exception e) {
System.out.println(e.getMessage());
}
}
}

 

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events