OAuth for Integrations

Join the Beta!

The Datadog Developer Platform is in beta. If you don't have access, contact apps@datadoghq.com.

Overview

OAuth enables users to authorize third-party integrations with access to specific scopes of users’ Datadog data. This authorization allows integrations to push data into Datadog and pull data out from Datadog. For example, if a user authorizes an integration for read access to their Datadog monitors, the integration can directly read and extract their monitor data.

For more information on Datadog’s OAuth implementation, see the Datadog OAuth2 documentation.

Use OAuth in an integration

OAuth allows Datadog customers to easily and securely authorize third-party platforms through a couple of clicks—without having to directly input API or app keys anywhere. You can use OAuth with existing integrations or configure OAuth as a part of developing new integrations.

When building an integration with OAuth, you can select the exact scopes of data that your application needs access to, and the customer can grant access to the granular scopes that you’ve requested. While optional scopes are not supported, all scopes requested by an integration become accessible when a customer authorizes it.

Build an integration with OAuth

This section describes how to build a new integration with a tile on the Marketplace or Integrations page. If you’re building upon an existing integration, or building a new integration and want to add it to an existing tile on either page, see Adding OAuth to an existing offering.

Create an app from a template

  1. Navigate to the Datadog Developer Platform and click +New App.

    You need to create an app for each integration OAuth client. Datadog ties this app to your integration once your integration is published.

  2. Select a Blank App and add a name for your app.

  3. Click Create.

  4. In the Basic Information tab, complete the fields that populate in the details view.

  5. Once you are ready to publish your OAuth client, click the Mark Stable button.

  6. Click Save.

Create an OAuth client

The client is the component of an application that enables users to authorize the application access to the customer’s Datadog data. In order to gain access, the client requires the appropriate access token.

  1. Navigate to the OAuth & Permissions tab under Features and click New Confidential OAuth Client.

    The OAuth clients you create for integrations are confidential clients that provide a client ID and client secret. The client you create in this step is a private version of the client, whose credentials you can use for testing. When a published version of this client is created, you will receive a new set of credentials. These credentials are never shown again after you create the client, so be sure to store them in a secure location.

  2. Enter your client information such as the name, description, redirect URIs, and onboarding URL.

  3. Configure scopes for the OAuth client by searching for scopes and selecting their checkboxes in the Requested column.

    Scopes determine the types of data your app can access in the customer’s Datadog account. This allows your integration to access the necessary scopes. Only request the minimum amount of scopes required for your use case, as more can be added later on as needed.

    In order to submit data into Datadog, the api_keys_write scope must be selected. This is a private scope that is only approved for integration partners and allows you to create an API key on the user’s behalf, which you can use to send data into Datadog.

  4. Click Save Changes.

  5. After creating an OAuth client and assigning it scopes, you can implement the OAuth PKCE protocol in your integration, complete the authorization code grant flow, and start writing integration code utilizing the endpoints available through OAuth.

    In the authorization code grant flow, you receive an authorization code and refresh token, then exchange the code for an access token that can be used to access the data you want to pull from Datadog.

    For more information about implementing the OAuth protocol with Datadog, see Datadog OAuth2. For more information about building and publishing an integration, see the Integrations developer documentation.

Test the OAuth client

Once you have implemented the OAuth protocol, you should test your OAuth client to ensure that you can send data into Datadog, or pull data out, according to your use case.

Note: Until your integration tile is published, you can only authorize the OAuth client from your sandbox organization. This means that you can only send data into or pull data out of your sandbox account.

To test your OAuth client, complete the following steps:

Test that authorization is working properly

Ensure that you do not encounter any errors when going through the basic authorization flow.

  1. Navigate to the Developer Platform, click the Edit icon on your app, and open the OAuth and Permissions tab.
  2. Select your OAuth client, and click the Test Authorization button on your client’s details page.
  3. This directs you to the onboarding URL and starts the authorization flow that a customer takes. By clicking this button, the domain parameter is provided on the redirect to the onboarding_url.
  4. Go through the OAuth flow and authorize your integration.

Create an API Key

If your OAuth client requests the api_keys_write scope, ensure that you can successfully make a request to the marketplace_create_api endpoint with your token in the headers of the request.

If successful, this request returns an API key that you can find on the API Keys Management page. You must securely save this key to use it for submitting data into Datadog on behalf of the user. You cannot access this API key value again after the initial request response.

Test multiple Datadog sites

Test that your OAuth client can work across multiple Datadog sites by kicking off authorization from your EU Datadog sandbox organization.

  1. If you do not have access to a sandbox account on a different site, contact ecosystems@datadog.com.
  2. Export your app manifest from the organization in the original US1 Datadog site by navigating to the app you’ve created in the Developer Platform, clicking the Gear icon to the right of Documentation, and clicking Export App Manifest.
  3. In your EU sandbox organization, navigate to the Developer Platform and import your app manifest from Step 2.
  4. After successfully importing your manifest, navigate to the OAuth & Permissions tab to find your OAuth client, along with its client ID and client secret. Update your OAuth implementation to use these credentials.
  5. Navigate to the Test Authorization button, click it, and go through the OAuth flow.

Confirm data flow for all scopes

Ensure that you are able to send data in, pull data out, or edit data for each scope you’ve requested.

Publish the OAuth client

Create or update your pull request

In order to publish an OAuth client, you first need to open a pull request for your integration in either the integrations-extras or Marketplace GitHub repositories if you haven’t already.

As a part of your pull request, complete the following steps:

  1. Update your README file with an ## Uninstallation section under ## Setup that includes the following instructions (along with any custom instructions you would like to add): - Once this integration has been uninstalled, any previous authorizations are revoked. - Additionally, ensure that all API keys associated with this integration have been disabled by searching for the integration name on the API Keys page.
  2. Update your manifest.json file to reference this new ## Uninstallation section. This reference should appear directly beneath the support field: - "support": "README.md#Support", "uninstallation": "README.md#Uninstallation",

Initiate publishing process in Developer Platform

To start the publishing process in the Developer Platform:

  1. Navigate to the Publishing tab under General. In Step 1 of the publishing flow, you receive your published client ID and secret. The OAuth implementation needs to be updated to include these client credentials. Note: Save your client ID and client secret in a secure location. This information is not shown again.

  2. In Step 2, you can enter additional information about your integration and see the published app_uuid to use below.

  3. When opening a pull request for a new integration in integrations-extras or Marketplace, use the app_uuid value from step 2 in the app_uuid field of the manifest.json file. If the app_uuid values do not align, your application does not publish correctly. If you have an existing integration, there is no need to update the app_uuid.

Once an OAuth client is submitted for publishing, the team is notified. When your pull request is approved by all required parties and is ready to be merged, at that point your OAuth client gets published as well. Your integration tile is then published to your sandbox account (not for all customers), and your OAuth client can then be authorized by any Datadog organization (not only your Sandbox organization).

At this point, Datadog recommends doing final testing with your OAuth client to ensure authorization is working smoothly.

Making changes after submitting your client for publishing

You cannot edit a published OAuth client directly, so only go through the publishing flow when everything has been tested and is ready to go. To make updates to the OAuth client after it has been submitted for publishing, you need to go through the publishing flow again and re-submit. The published client credentials do not appear again.

For more information about publishing your integration tile and creating your pull request, see the Marketplace and Integrations documentation.

Add OAuth to an existing offering

The process for adding an OAuth client to an existing integration is similar to what is outlined above, with some key differences.

If you have an existing integration that’s not connected to a UI Extension

Follow the steps above, and ensure that you open a pull request to add new uninstallation instructions to your integration tile.

There’s no need to change your app_uuid in the manifest.json file if you have an existing integration.

If you have an existing integration that’s currently connected to a UI Extension (shares the same tile)

Instead of creating an app, navigate to the app that includes your published UI Extension in the Developer Platform and follow the remaining steps.

Once you’ve created your integration’s OAuth client and are ready for publishing, click Edit on your app and navigate to the Publishing tab under General. Ensure that you also open a pull request to add new uninstallation instructions to your tile.

Note: There’s no need to change your app_uuid in the manifest.json file if you have an existing integration or UI Extension.

If you have a published UI Extension and want to add an integration to the same tile

Instead of creating an app, navigate to the app that includes your published UI Extension in the Developer Platform and follow the remaining steps.

Open a pull request to update your existing tile with additional information about your integration—including updates to the README, image folder, and more. Add a link to this pull request during the publishing process.

Further Reading

Additional helpful documentation, links, and articles: