Skip to content

Commit cf03f17

Browse files
authored
Document Datadog Apps OAuth support (#37653)
* Document Datadog Apps OAuth auth * Fix Datadog Apps local dev list formatting * Clarify Datadog Apps auth variables * Update Datadog Apps OAuth docs * Restore action catalog integration wording
1 parent 98c3614 commit cf03f17

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

content/en/actions/datadog_apps.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Choose Apps when you need:
4040
```shell
4141
node --version
4242
```
43-
- A Datadog **API key** and an **application key** with [Actions API Access][5] enabled. For instructions on creating keys, see [API and Application Keys][6].
43+
- Optional: A Datadog **API key** and an **application key** with [Actions API Access][5] enabled. Required for API-key-backed build telemetry (build metrics and Error Tracking sourcemap uploads) and for CI/CD uploads. For instructions, see [API and Application Keys][6].
4444

4545
To enable Actions API Access on an application key:
4646

@@ -69,20 +69,15 @@ The scaffolded project includes:
6969

7070
## Develop your app locally
7171

72-
1. Set your Datadog credentials as environment variables:
73-
74-
```shell
75-
export DD_API_KEY="<YOUR_API_KEY>"
76-
export DD_APP_KEY="<YOUR_APPLICATION_KEY>"
77-
```
78-
79-
2. Start the development server:
80-
72+
1. Start the development server:
8173
```shell
8274
npm run dev
8375
```
76+
2. Open the URL shown in the terminal (for example, `http://localhost:5173/`) to preview your app.
77+
78+
When the dev server needs to call Datadog, such as when running a backend function locally, it uses OAuth by default. If authorization is required, the command opens a browser prompt. After authorization completes, the token is cached in your operating system credential store.
8479

85-
3. Open the URL shown in the terminal (for example, `http://localhost:5173/`) to preview your app.
80+
If you set both `DD_API_KEY` and `DD_APP_KEY`, the generated app uses those keys instead of OAuth.
8681

8782
### Backend functions
8883

@@ -150,12 +145,15 @@ Use `npm run upload` to build and upload the app to Datadog. This runs `vite bui
150145
npm run upload
151146
```
152147

148+
Uploads use OAuth by default and may open a browser authorization flow the first time. If you set both `DD_API_KEY` and `DD_APP_KEY`, uploads use API and application key authentication instead.
149+
153150
The following environment variables are available:
154151

155152
| Variable | Description |
156153
|---|---|
157-
| `DD_API_KEY` | Datadog API key. |
158-
| `DD_APP_KEY` | Datadog application key. |
154+
| `DD_API_KEY` | Optional. Datadog API key used with `DD_APP_KEY` for local development and uploads. Also enables API-key-backed build telemetry, such as build metrics and Error Tracking sourcemap uploads. |
155+
| `DD_APP_KEY` | Optional. Application key used with `DD_API_KEY` for local development and uploads. |
156+
| `DD_APPS_AUTH_METHOD` | Optional. Set to `oauth` or `apiKey` to override the generated app's authentication method. |
159157
| `DD_APPS_VERSION_NAME` | Optional. The version name for the uploaded app version. Must be a unique string per app. If unset, Datadog assigns a version name. |
160158
| `DD_APPS_UPLOAD_ASSETS` | If set, uploads built assets to Datadog. Set automatically by `npm run upload`. |
161159

@@ -185,6 +183,8 @@ To change an app's UI or logic, update the code in your local project and re-upl
185183

186184
To automatically upload your app on every push to the `main` branch, use the [`DataDog/apps-github-action`][11] GitHub Action. This action builds your app and uploads it to Datadog.
187185

186+
CI/CD uploads require API and application key authentication. Create a Datadog API key and an application key with [Actions API Access][5] enabled, then store them as GitHub secrets.
187+
188188
If your organization is not on US1 (`datadoghq.com`), set `auth.site` in `vite.config.ts` to your [Datadog site][15]. The build reads this configuration when uploading the app, so the same setting also applies to local development. Your Datadog site is `{{< region-param key="dd_site" >}}`.
189189

190190
{{< site-region region="us3,us5,eu,ap1,ap2" >}}
@@ -237,15 +237,23 @@ jobs:
237237
238238
### Authentication errors
239239
240-
Authentication errors (such as 401 or `Missing authentication token`) and backend function call failures usually point to missing or invalid credentials. Verify that `DD_API_KEY` and `DD_APP_KEY` are set, and that the application key has [Actions API Access][5] enabled.
240+
For local development and uploads, OAuth authentication errors may have one of these causes:
241+
242+
- The OAuth browser flow did not complete.
243+
- The cached OAuth token is invalid.
244+
- `auth.site` does not match your Datadog site.
245+
246+
Rerun the command and complete the browser authorization flow.
247+
248+
If you use API and application key authentication, authentication errors usually point to missing or invalid credentials. Backend function call failures can have the same cause. Verify that `DD_API_KEY` and `DD_APP_KEY` are set, and that the application key has [Actions API Access][5] enabled.
241249

242250
### Build succeeds but nothing uploads
243251

244252
Make sure you ran `npm run upload` (not `npm run build`), and that `dryRun` in `vite.config.ts` is not set to `true`.
245253

246254
### Node.js version errors during scaffolding
247255

248-
The scaffolding tool requires Node.js 20.12.0 or later. If you see errors even on a supported version, upgrade to v22. Use a version manager such as [nvm][16], [Volta][17], or [fnm][18], or download from [nodejs.org][19].
256+
The scaffolding tool requires Node.js 20.12.0 or later. If you see errors even on a supported version, upgrade to v22. Use a version manager such as [nvm][16], [Volta][17], or [fnm][18], or download from the [Node.js website][19].
249257

250258
## Further reading
251259

0 commit comments

Comments
 (0)