Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

program to fetch the api token of a user in a connect app?

I am trying to make a connect app.In the app I'll need the api token of the user to add some information to user's(user is the one who installed the app)jira instance.My connect app should fetch user's api token.Can anyone please tell me how can I add a program which fetches users api-token

2 answers

0 votes

@Harshit Somani When using ACE (, there are also options that are also options that are much more straightforward.

They are documented in the file in the How to send a signed outbound HTTP request back to the host paragraph.

This is how it is currently documented:



0 votes
Dario B Atlassian Team Mar 26, 2021

Hello @Harshit Somani ,

It is not clear why you would need the user API Token in order to add some information about the user in the instance. Can you please clarify?

I am asking because in a connect app you can just impersonate the user and do whatever change on behalf the user:

User impersonation for Connect apps

Atlassian Connect supports user impersonation via the JWT Bearer token authorization grant type for OAuth 2.0. This authorization method allows apps with the appropriate scope (ACT_AS_USER) to access resources and perform actions in Jira and Confluence on behalf of users.


For further details on this please see:


Finally, for the future, please notice that this is not the best place to get help on development  related questions. The right resources are listed in 




@Dario B  
As shown in this link,
I am trying to add assets to jira instance,If I use the same python code shown in that link,

response = requests.request( "GET",


headers=headers )

we'll get an error which says 

{"errorMessage":"Request must be made by an active logged in user"}.

In order to recctify this error we can change the code as

response = requests.request( "GET",


headers=headers ,


So in order to do a PUT or GET request we need the user mail and api token of the jira instance,So I want to retrivee mail id and api token and store them in variables and use those varaibles in my python code,so that any user need not enter his user credentials when trying to run this program


Hello @Harshit Somani ,

As already mentioned, if you are building a connect add-on then you don't need any API Token since connect add-on use a different way to authenticate and impersonate users ( see Security for Connect apps and User impersonation for Connect apps for details).


Once this has been said, please notice that:

  • The code snippet from the page you are referring to is just an example and it is not taking authentication/authorization into account. Having implemented security for your connect app (JWT) then this should work with no need of any API Token. 
  • Saving the API Tokens of all the users in your site into an external app could pose a security risk.
  • If you are still convinced you want to proceed your way, there is a REST API endpoint to get all the users API Tokens available, but it only works with managed users.For details see:


I hope this helps.



Suggest an answer

Log in or Sign up to answer
Site Admin

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you