Forums

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

Confluence Java Client Bearer Token Authentication

Andreas Salmutter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 20, 2022

Hi guys,

 

I use the confluence-rest-client-7.9.3 library to access and modify a Confluence page from an Java application. Currently, the authentication to the Confluence server is done with user name and password e.g.

String userName = "user";
char[] password = "password".toCharArray();

AuthenticatedWebResourceProvider provider = AuthenticatedWebResourceProvider.createWithNewClient(url.getUrl());
provider.setAuthContext(username, password);

ListeningExecutorService listeningExecutorService = createListeningExecutorService();
RemoteContentService service = new RemoteContentServiceImpl(getProvider(), listeningExecutorService);

...

 

Now I want to change the authentication to use an access token (bearer token authentication). The library provides only the AuthenticatedWebResourceProvider which seems not to support access tokens.

How can I authenticate to the Confluence server with an access token from my Java application?

 

Cheers,

Andy

 

1 answer

0 votes
Fabio Racobaldo _Herzum_
Community Champion
September 25, 2022

Hi @Andreas Salmutter ,

welcome to the Atlassian community!

Please take a look to the following article https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

Hope this helps,

Fabio

Andreas Salmutter
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 26, 2022

Hi Fabio,

this articel does not really answer my question. I know how to create a PAT, but I don't know how to get the official Confluence Java library in my application to use the PAT for authentication.

BR,

Andreas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events