Forums

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

Can I use the personal access token directly in an URL?

QmUser
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!
April 19, 2022

Hello guys, 

I have the  following issue: I have created a personal access token for my account and if I use the REST API and curl I can see that access is granted and I get the json content. I'm new to Confluence and using the REST API and I wonder if the following is possible:

I would like to use my personal access token this way, e.g.:

https:\\my-site.atlassian.net\wiki\home?user=<personal access token>

and that this link will give me access to my personal user page in confluence. Does Confluence offers this type of access using a link? 

If not and only thru REST API and curl, how can I navigate to my Wiki/Home page in Confluence?

Any assistance or tips will be greatly appreciated.

1 answer

1 accepted

1 vote
Answer accepted
Oliver Siebenmarck _Polymetis Apps_
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 Leaders.
April 20, 2022

Hi @QmUser ,

Welcome to the community!

To the best of my knowledge, you cannot use the API token to access the normal web interface of Confluence – it only works with the REST API. And as you probably already know, there is no REST endpoint to retrieve the personalized home page. 

You basically have three options here: a) you just try and fetch all the relevant information that's on the home page manually using search with different queries to get things like recently worked on etc. This might be cumbersome, but it's the best and most reliable way to work with the API.

The second approach is a bit more hackish and I would discourage going that route if at all possible. But if you really must: curl is not really different from your browser and you can make it send one or more cookies along. Most web apps – including Confluence – use session cookies to keep track of who you are. You can extract that cookie using the dev tools in your browser and use that to authenticate curl commands. Of course, that leaves you with the oh-so-great task of parsing the HTML & JS that Confluence will through at you. Personally, I prefer the neat JSON I can get from the API.

Finally, the third way involves a tool like Selenium. Selenium allows you to write code to automate a web browser, like a remote control for Chrome. You could write code that tells Selenium to open https:\\yoursite.atlassian.net, log in as your user and navigate to the home page. You can then use Selenium to get the info you want from that page. This is slightly less hackish than option two, but still a lot of work. 

So, my strong recommendation would be to find a way to find the info you need with the REST API, but there are other options out there.

Hope that helps,
 Oliver

QmUser
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!
April 20, 2022

Wow @Oliver Siebenmarck _Polymetis Apps_! Thanks a lot for the great explanation and options. I will discuss them with the team and decide which approach to take. Great job, thanx!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events