Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How do I use a HTTP access token in a .netrc file

bob bobbens July 26, 2022

I created a HTTP access token in the Project settings and I would like to use the token in a .netrc file in a Ubuntu machine. Is this possible and how do I enter the information in to the .netrc file if it is possible?

1 answer

0 votes
Brian Hewson February 22, 2023

If you've created a token before January 2023:



echo "" > ~/.netrc-for-atlassian
chmod 600 ~/.netrc-for-atlassian
echo "machine <myhost>.atlassian.net login <my.name@email.address> password <64-bit token" >> ~/.netrc-for-atlassian

curl -n ~/.netrc-for-atlassian https://<myhost>.atlassian.net/rest/api/3/issue/<MY-ISSUE>

 


This has been working for me to great effect, however they've recently changed the api-token to a SIGNIFICANTLY longer string and every attempt to use the new api-token results in an error message
So curl or netrc is somehow broken with the new implementation, so I was looking to ask this exact question, but for newer tokens...

Brian Hewson February 22, 2023

After reading man netrc I figured it out:
This method will work for 256-bit api tokens generated after January 2023

echo "" > ~/.netrc-for-atlassian
chmod 600 ~/.netrc-for-atlassian
echo "machine <myhost>.atlassian.net login <my.name@email.address> account <64-bit token" >> ~/.netrc-for-atlassian

curl -n ~/.netrc-for-atlassian https://<myhost>.atlassian.net/rest/api/3/issue/<MY-ISSUE>

 That's it, now it works

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events