How do I generate API token from backend?

M S April 18, 2019

as you know, jira is changing their authentication method, if you want to integrate your app with jira which is hosted on their own cloud you are not allowed to use old user credential like username  and password and you have to use `API KEY` instead.

 

this is a documentation how to create API KEY for my self:

https://confluence.atlassian.com/cloud/api-tokens-938839638.html

 

but, let say I am creating an application an I want to integrate my application with Jira how can I find this `API KEY`? how can I generate this for user in backend?

 

1 answer

1 vote
Andy Heinzer
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 22, 2019

Hi Mazier,

There is some confusion here between the different types of tokens.   End users of Atlassian Cloud can create their own API tokens via the link you cited.  These are used in Basic Auth situations, such as for a script or a one time REST API call made with a utility like curl.   The link you cited is for this kind of API Token.  These have to be created by the end user directly.  There is no method for automating their creation via a plugin or by a site-admin's desire to do so.  This is by design.

Conversely, there are OAuth tokens that can be used for authentication.   These are much more likely to be used when a plugin/add-on/app for a product like Jira Cloud wants to make REST API calls as a specific user.   This is a much more secure way to handle authentication than Basic authentication is, but it tends to be more complex to setup and get working.   There are more details in OAuth for REST APIs: Jira Cloud platform Developer.   There is also the atlassian-oauth-examples that have the libraries needed in different languages to handle the OAuth Handshake (or do-the-OAuth-Dance) in various languages like Java, nodejs, perl, php, python, etc.  Depending on the language of your plugin/add-on, you can use one of those examples to walk though how you or your code could create these oauth tokens so that you could authenticate as these end users.

I hope this helps to clarify how to make this work.

Andy

Suggest an answer

Log in or Sign up to answer