Creating a Custom OAuth App
If you do not have access to the user name and API token or do not wish to require them, you can use OAuth authentication. Jira Service Desk uses the OAuth authentication standard, which requires the authenticating user to interact with Jira Service Desk via the browser. The driver facilitates the OAuth exchange in various ways, as described in this section.
NOTE: Jira Service Desk supports OAuth 2.0 only.
When To Create a Custom OAuth App
CData embeds OAuth Application Credentials with CData branding that can be used when connecting via a desktop application or headless application.You may choose to use your own OAuth Application Credentials when you want to
- control branding of the Authentication Dialog
- control the redirect URI that the application redirects the user to after the user authenticates
- customize the permissions that you are requesting from the user
Create an OAuth App
To obtain the OAuth client credentials, consumer key, and consumer secret:
- Log in to your Jira Service Desk site.
- Navigate to your application management: https://developer.atlassian.com/apps/.
- Select Create new app, then name the app.
- If missing, add OAuth 2.0 functionality to your application by navigating to APIS AND FEATURES > + Add > Add OAuth 2.0 (3LO).
- From APIS AND FEATURES > + Add, add the JIRA Service Desk platform REST API to your app. You also need to add the JIRA application to get all of the functionalities of the driver.
- From APIS AND FEATURES > + JIRA Service Desk platform REST API, add the desired scopes to your app.
- Set up your Callback URL. Navigate to APIS AND FEATURES > OAuth 2.0 (3LO). Enter a URL that is accessible to your application and save the changes.
Desktop Applications
After setting the following connection properties, you are ready to connect:
- OAuthClientId: Set to the consumer key in your application details.
- OAuthClientSecret: Set to the consumer secret in your application details.
- CallbackURL: Set to the callback URL found in your application details under APIS AND FEATURES > OAuth 2.0 (3LO).
- InitiateOAuth: Set to GETANDREFRESH. You can use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken connection property.
- OAuthVersion: Set to 2.0.
- Url: The URL to your Jira Service Desk endpoint; for example, https://yoursitename.atlassian.net.
When you connect, the driver opens the OAuth endpoint in your default browser. Log in and grant permissions to the application. The driver then completes the following OAuth process:
- Gets the callback URL and sets the access token to authenticate requests.
- Saves OAuth values in OAuthSettingsLocation. These values persist across connections.
- Exchanges the returned refresh token for a new and valid access token.
Web Applications
To obtain the access token, set the following connection properties:
- OAuthClientId: Set to the consumer key in your application details.
- OAuthClientSecret: Set to the consumer secret in your application details.
- CallbackURL: Set to the callback URL in your application details under APIS AND FEATURES > OAuth 2.0 (3LO).
- Url: The URL to your Jira Service Desk endpoint; for example, https://yoursitename.atlassian.net.
- OAuthVersion: Set to 2.0.
When connecting via a web application, or if the driver is not authorized to open a browser window, you need to exchange temporary verification values for the access token:
- Call GetOAuthAuthorizationURL. The stored procedure returns the URL to the OAuth endpoint.
- Log in and authorize the application. You are redirected back to the callback URL. If you set the GrantType parameter to Implicit, the callbackURL contains the OAuthAccessToken in a query string parameter. If you set the GrantType parameter to code, the callback URL contains the verifier code in the query string parameter named "code". Extract the verifier code and call GetOAuthAccessToken.
To connect to data, set the following connection properties:
- OAuthAccessToken
- OAuthVersion
- OAuthClientId
- OAuthClientSecret
- OAuthAccessToken
- Url