Create OAuth 2.0 credential for service accounts
What are OAuth 2.0 credentials?
OAuth 2.0 is the industry-standard protocol for authorization. OAuth 2.0 credentials allows applications to access resources like Jira on behalf of a service account securely and with permission, without using passwords.
OAuth 2.0 credentials allow you to use a service account for secure, automated access to APIs without human intervention. You can securely automate tasks and run integrations like integrating Clockify with Jira to measure time spent to resolve issues.
The service account uses the OAuth 2.0 credentials which include a client ID and client secret to prove its identity. When the service account authenticates with an OAuth 2.0 credential it can call Atlassian APIs securely.
How to use OAuth 2.0 credentials
The primary use case is for apps and services to access Atlassian APIs. You can integrate your third-party OAuth apps to access Atlassian APIs. You can also use them for running scripts but you will need to manage token rotation. When the token rotates your script needs to call the API again.
When you create an OAuth 2.0 credential, we generate a client_id and client_secret. You can then configure your apps or scripts with client ID and client secret to access your products in Atlassian cloud. Then you can access your apps or scripts with an OAuth 2.0 access token.
How to access Atlassian app APIs with OAuth 2.0 credentials
Make a POST request to
https://auth.atlassian.com/oauth/token
with client_id and client_secret to get the OAuth 2.0 access token valid for 60 minutes.When you make the API call, include the
ACCESS_TOKEN
in theAuthorization
header as a Bearer token.
For example, when you want to retrieve a specific Jira issue on a Jira board by calling an API. you call the following API with the ACCESS_TOKEN in the Authorization header:
curl --request GET \
--url https://api.atlassian.com/ex/jira/{cloudId}/rest/api/2/issue/{ISSUE_KEY} \
--header 'Authorization: Bearer ACCESS_TOKEN' \
--header 'Accept: application/json'
We use a varied OAuth 2.0 credential length OAuth 2.0 credentials rather than fixed length to ensure OAuth 2.0 credentials are more secure and reliable. If your script relies on fixed OAuth 2.0 credential length, check that it can handle a variable length.
Create an OAuth 2.0 credential
When you create an OAuth 2.0 credential, you can name the credential and describe its purpose.
What are scopes for OAuth 2.0 credentials?
OAuth 2.0 credentials for service accounts use scopes by default. The scope for an OAuth 2.0 credential defines the levels of access to data in your Atlassian apps. When you create an OAuth 2.0 credential, you choose the access level for it.
When you select scopes for the credential, you give the OAuth 2.0 credential permissions to perform certain actions. You can only select scopes for Jira and Confluence.
This is the supported URL for API calls: api.atlassian.com
Format for constructing an API call
Jira public API | Confluence public API |
---|---|
|
|
Create an OAuth 2.0 credential for a service account
You must create a service account before you can create the OAuth 2.0 credential for the service account.
When you create an OAuth 2.0 credential for a service account, the service account can authenticate and run scripts for the apps you give them access to. When you create an OAuth 2.0 credential you must select scopes.
To create an OAuth 2.0 credential for a service account:
admin.atlassian.com に移動します。 複数の組織がある場合は、対象の組織を選択します。
Select Directory> Service accounts.
Select Actions for the service account.
Select Create credential.
Choose Authentication type > OAuth 2.0.
Select API scopes to determine what action the OAuth 2.0 credential can perform in your app.
Review your OAuth 2.0 credential scope information.
Select Create to save the OAuth credential.
Copy your client ID and client secret and save them somewhere safe. You can't recover them after you create the credential. We recommend you save the ID and secret in a password manager.
Revoke an OAuth 2.0 credential
When you revoke a OAuth 2.0 credential for a service account it no longer works and we permanently remove it from your account. If you revoke an existing OAuth 2.0 credential, you can replace it with another OAuth 2.0 credential.
To revoke an OAuth 2.0 credential:
admin.atlassian.com に移動します。 複数の組織がある場合は、対象の組織を選択します。
Select Directory> Service accounts.
Select the service account > Credentials.
Select Revoke for the credentials that you want to revoke.
To revoke all OAuth 2.0 credentials for a service account, select Revoke credentials.
OAuth 2.0 credential settings
You can use OAuth 2.0 credentials with Confluence Cloud, Jira Cloud and Jira Align REST APIs. If you're using Bitbucket Cloud, see App passwords.
設定 | 説明 |
---|---|
OAuth 2.0 credential name | Give your OAuth 2.0 credential a name that explains what it does. |
この内容はお役に立ちましたか?