Skip to content

[wrangler] Document opt-in OS keychain credential storage#31211

Open
petebacondarwin wants to merge 2 commits into
productionfrom
pbd/wrangler-keyring-credential-storage
Open

[wrangler] Document opt-in OS keychain credential storage#31211
petebacondarwin wants to merge 2 commits into
productionfrom
pbd/wrangler-keyring-credential-storage

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Documents the opt-in OS keychain credential storage feature added to Wrangler in cloudflare/workers-sdk#14156.

Changes:

  • src/content/docs/workers/wrangler/commands/general.mdx
    • Adds --use-keyring / --no-use-keyring to the wrangler login flags.
    • Adds a new "Storing OAuth credentials in the OS keychain" subsection covering opt-in, per-platform backends (macOS security, Linux secret-tool, Windows @napi-rs/keyring), wrangler whoami reporting, opt-out semantics (deletes the encrypted file — does not decrypt onto disk), the CLOUDFLARE_AUTH_USE_KEYRING per-process override, and compatibility with API-token auth.
    • Updates the wrangler logout description to note keychain cleanup.
  • src/content/docs/workers/wrangler/system-environment-variables.mdx
    • Adds CLOUDFLARE_AUTH_USE_KEYRING to the supported environment variables list.
  • src/content/changelog/workers/2026-06-03-wrangler-keyring-credential-storage.mdx
    • New changelog entry announcing the feature with the user-facing usage summary.

Companion PRs

Documentation checklist

  • Is there a changelog entry (guidelines)? Yes — 2026-06-03-wrangler-keyring-credential-storage.mdx.
  • The change adheres to the documentation style guide.
  • If a larger change - such as adding a new page- an issue has been opened in relation to any incorrect or out of date information that this PR fixes. N/A — this documents a new opt-in feature; no existing information is incorrect.
  • Files which have changed name or location have been allocated redirects. N/A — no renames or moves.

Open in Devin Review

@cloudflare-docs-bot

cloudflare-docs-bot Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review

⚠️ 2 warnings and 7 suggestions found in commit 1b1c85a.

Warnings (2)
File Issue
changelog/agents/2025-03-18-npm-i-agents.mdx line 71 Remove contractions in prose — Line starts with We've added a new ... Fix: Change We've to We have.
changelog/agents/2025-11-26-agents-resumable-streaming.mdx line 63 Use root-relative paths for internal links — Line adds an internal link as https://developers.cloudflare.com/agents/runtime/execution/schedule-tasks/ Fix: Change the link to /agents/runtime/execution/schedule-tasks/
Suggestions (7)
File Issue
changelog/browser-run/2026-06-11-browser-run-snapshot-formats.mdx line 15 Bullet list with fewer than three items — Added list has only two bullet items describing Markdown and accessibility tree benefits. Fix: Consider rewriting the two items as prose instead of a bullet list.
changelog/agents/2025-03-18-npm-i-agents.mdx line 131 Use the Oxford comma for lists of three or more items — Bullet lists useAgent, useAgentChat and the new @unstable_callable RPC decorator without a comma before and Fix: Add a comma before and: useAgent, useAgentChat, and the new @unstable_callable RPC decorator`
changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx line 76 Avoid 'See [link]' — Line uses 'See [Protocol messages]...' Fix: Replace with 'refer to Protocol messages' or 'For more information, refer to Protocol messages.'
changelog/agents/2026-02-17-agents-sdk-v0.5.0.mdx line 84 Avoid 'See [link]' — Bullet uses 'See [Data parts]...' Fix: Replace with 'refer to Data parts'.
changelog/agents/2026-02-03-agents-workflows-integration.mdx line 178 Avoid see [link]; use refer to [link] — Line adds ... see [Run Workflows](/agents/runtime/execution/run-workflows/). Fix: Change to For the complete Workflows API reference and patterns, refer to [Run Workflows](/agents/runtime/execution/run-workflows/).
changelog/agents/2026-02-20-codemode-sdk-rewrite.mdx line 69 Avoid 'See the [link]' — use 'refer to' — Line reads 'See the Code Mode documentation for full API reference and examples.' Fix: Rewrite as 'For more information, refer to the Code Mode documentation.'
changelog/agents/2026-03-17-codemode-sdk-v0.2.1.mdx line 94 Avoid See the [Page] — Line adds See the [Code Mode documentation](/agents/model-context-protocol/protocol/codemode/) for the full API reference. Fix: Rephrase with refer to, e.g. For the full API reference, refer to [Code Mode documentation](/agents/model-context-protocol/protocol/codemode/).
Commands

Only codeowners can run commands. Post a comment with the command to trigger it.

Command Description
/review Runs a review now. Incremental if a prior review exists, full if not.
/full-review Re-reviews the entire PR diff from scratch, ignoring incremental history. Useful after a rebase, when you want a fresh review, or if the bot gets out of sync and reports issues that no longer exist.
/ignore-review-limit Permanently lifts the 2-review automatic limit for this PR. Future pushes will trigger reviews as normal.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
/src/content/changelog/ @cloudflare/pm-changelogs, @cloudflare/product-owners
/src/content/docs/workers/wrangler/ @cloudflare/wrangler, @irvinebroque, @cloudflare/product-owners, @MattieTK, @vy-ton

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 2 potential issues.

View 3 additional findings in Devin Review.

Open in Devin Review

- **Linux** uses [libsecret](https://wiki.gnome.org/Projects/Libsecret) via the `secret-tool` CLI from the `libsecret-tools` package.
- **Windows** uses Credential Manager via [`@napi-rs/keyring`](https://www.npmjs.com/package/@napi-rs/keyring), installed on-demand the first time you opt in.

Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for the full details, including the migration behavior on opt-in/opt-out and the `CLOUDFLARE_AUTH_USE_KEYRING` environment variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Broken link: anchor targets commands index page instead of commands/general page

The link /workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain resolves to src/content/docs/workers/wrangler/commands/index.mdx, which is a navigation page containing only #workers-commands, #all-commands, and #how-to-run-wrangler-commands anchors. The #storing-oauth-credentials-in-the-os-keychain anchor exists in src/content/docs/workers/wrangler/commands/general.mdx:116, so the correct path is /workers/wrangler/commands/general/#storing-oauth-credentials-in-the-os-keychain. Other changelog entries in the repo correctly use the /workers/wrangler/commands/general/#... pattern for anchors in general.mdx.

Suggested change
Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for the full details, including the migration behavior on opt-in/opt-out and the `CLOUDFLARE_AUTH_USE_KEYRING` environment variable.
Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/general/#storing-oauth-credentials-in-the-os-keychain) for the full details, including the migration behavior on opt-in/opt-out and the `CLOUDFLARE_AUTH_USE_KEYRING` environment variable.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

- The Client Secret of a [Cloudflare Access Service Token](/cloudflare-one/access-controls/service-credentials/service-tokens/), used together with `CLOUDFLARE_ACCESS_CLIENT_ID` to authenticate with Access-protected domains in non-interactive environments. For the full Access policy and service token setup, refer to [Connect to Access-protected Workers](/workers/development-testing/#connect-to-access-protected-workers).

- `CLOUDFLARE_AUTH_USE_KEYRING` <Type text="boolean" /> <MetaInfo text="optional" />
- Options for this are `true` and `false`. Defaults to unset. Overrides the persistent preference set by `wrangler login --use-keyring` / `--no-use-keyring` for a single invocation. When `true`, Wrangler stores OAuth credentials in an encrypted file with the encryption key held in the OS keychain, and exits with an error if the keychain backend is unavailable. When `false`, Wrangler uses the legacy plaintext TOML file even if the persistent preference is enabled. Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for details.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Broken link: anchor targets commands index page instead of commands/general page

Same issue as in the changelog — the link /workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain points to the commands index page (src/content/docs/workers/wrangler/commands/index.mdx), which does not contain the target anchor. The anchor exists in src/content/docs/workers/wrangler/commands/general.mdx:116. The correct path is /workers/wrangler/commands/general/#storing-oauth-credentials-in-the-os-keychain.

Suggested change
- Options for this are `true` and `false`. Defaults to unset. Overrides the persistent preference set by `wrangler login --use-keyring` / `--no-use-keyring` for a single invocation. When `true`, Wrangler stores OAuth credentials in an encrypted file with the encryption key held in the OS keychain, and exits with an error if the keychain backend is unavailable. When `false`, Wrangler uses the legacy plaintext TOML file even if the persistent preference is enabled. Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for details.
- Options for this are `true` and `false`. Defaults to unset. Overrides the persistent preference set by `wrangler login --use-keyring` / `--no-use-keyring` for a single invocation. When `true`, Wrangler stores OAuth credentials in an encrypted file with the encryption key held in the OS keychain, and exits with an error if the keychain backend is unavailable. When `false`, Wrangler uses the legacy plaintext TOML file even if the persistent preference is enabled. Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/general/#storing-oauth-credentials-in-the-os-keychain) for details.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@ask-bonk ask-bonk Bot added documentation Documentation edits changelog Adds or updates changelog entries/pages. labels Jun 3, 2026

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few issues to address before merge.

date: 2026-06-03
---

[Wrangler](/workers/wrangler/) can now store the OAuth credentials returned by `wrangler login` in an [AES-256-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode)-encrypted file, with the encryption key held in your operating system's keychain. The default behavior is unchanged — credentials still live in a plaintext TOML file unless you opt in.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid the possessive for an inanimate object per the style guide:

Suggested change
[Wrangler](/workers/wrangler/) can now store the OAuth credentials returned by `wrangler login` in an [AES-256-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode)-encrypted file, with the encryption key held in your operating system's keychain. The default behavior is unchanged — credentials still live in a plaintext TOML file unless you opt in.
[Wrangler](/workers/wrangler/) can now store the OAuth credentials returned by `wrangler login` in an [AES-256-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode)-encrypted file, with the encryption key held in your operating system keychain. The default behavior is unchanged — credentials still live in a plaintext TOML file unless you opt in.

- **Linux** uses [libsecret](https://wiki.gnome.org/Projects/Libsecret) via the `secret-tool` CLI from the `libsecret-tools` package.
- **Windows** uses Credential Manager via [`@napi-rs/keyring`](https://www.npmjs.com/package/@napi-rs/keyring), installed on-demand the first time you opt in.

Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for the full details, including the migration behavior on opt-in/opt-out and the `CLOUDFLARE_AUTH_USE_KEYRING` environment variable.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This links to the navigation index page, not the general commands page:

Suggested change
Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for the full details, including the migration behavior on opt-in/opt-out and the `CLOUDFLARE_AUTH_USE_KEYRING` environment variable.
Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/general/#storing-oauth-credentials-in-the-os-keychain) for the full details, including the migration behavior on opt-in/opt-out and the `CLOUDFLARE_AUTH_USE_KEYRING` environment variable.

- `--callback-port` <Type text="string" /> <MetaInfo text="optional" />
- Defaults to `8976`. Sets the port where Wrangler should listen for the OAuth callback.
- `--use-keyring` <Type text="boolean" /> <MetaInfo text="optional" />
- Store the OAuth credentials in your operating system's keychain instead of the default plaintext TOML file. Refer to [Storing OAuth credentials in the OS keychain](#storing-oauth-credentials-in-the-os-keychain) for details. Use `--no-use-keyring` to opt back out. The choice is persisted across Wrangler invocations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use third-person verb form for consistency with other flags, and avoid the possessive for an inanimate object:

Suggested change
- Store the OAuth credentials in your operating system's keychain instead of the default plaintext TOML file. Refer to [Storing OAuth credentials in the OS keychain](#storing-oauth-credentials-in-the-os-keychain) for details. Use `--no-use-keyring` to opt back out. The choice is persisted across Wrangler invocations.
- Stores the OAuth credentials in your operating system keychain instead of the default plaintext TOML file. Refer to [Storing OAuth credentials in the OS keychain](#storing-oauth-credentials-in-the-os-keychain) for details. Use `--no-use-keyring` to opt back out. The choice is persisted across Wrangler invocations.


### Storing OAuth credentials in the OS keychain

By default, Wrangler stores the OAuth access token and refresh token returned by `wrangler login` in a plaintext TOML file under the global Wrangler config directory (typically `~/.config/.wrangler/config/default.toml`). Pass `--use-keyring` to opt in to a more secure storage path that uses your operating system's keychain:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid the possessive for an inanimate object:

Suggested change
By default, Wrangler stores the OAuth access token and refresh token returned by `wrangler login` in a plaintext TOML file under the global Wrangler config directory (typically `~/.config/.wrangler/config/default.toml`). Pass `--use-keyring` to opt in to a more secure storage path that uses your operating system's keychain:
By default, Wrangler stores the OAuth access token and refresh token returned by `wrangler login` in a plaintext TOML file under the global Wrangler config directory (typically `~/.config/.wrangler/config/default.toml`). Pass `--use-keyring` to opt in to a more secure storage path that uses your operating system keychain:

- The Client Secret of a [Cloudflare Access Service Token](/cloudflare-one/access-controls/service-credentials/service-tokens/), used together with `CLOUDFLARE_ACCESS_CLIENT_ID` to authenticate with Access-protected domains in non-interactive environments. For the full Access policy and service token setup, refer to [Connect to Access-protected Workers](/workers/development-testing/#connect-to-access-protected-workers).

- `CLOUDFLARE_AUTH_USE_KEYRING` <Type text="boolean" /> <MetaInfo text="optional" />
- Options for this are `true` and `false`. Defaults to unset. Overrides the persistent preference set by `wrangler login --use-keyring` / `--no-use-keyring` for a single invocation. When `true`, Wrangler stores OAuth credentials in an encrypted file with the encryption key held in the OS keychain, and exits with an error if the keychain backend is unavailable. When `false`, Wrangler uses the legacy plaintext TOML file even if the persistent preference is enabled. Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for details.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This links to the navigation index page, not the general commands page:

Suggested change
- Options for this are `true` and `false`. Defaults to unset. Overrides the persistent preference set by `wrangler login --use-keyring` / `--no-use-keyring` for a single invocation. When `true`, Wrangler stores OAuth credentials in an encrypted file with the encryption key held in the OS keychain, and exits with an error if the keychain backend is unavailable. When `false`, Wrangler uses the legacy plaintext TOML file even if the persistent preference is enabled. Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/#storing-oauth-credentials-in-the-os-keychain) for details.
- Options for this are `true` and `false`. Defaults to unset. Overrides the persistent preference set by `wrangler login --use-keyring` / `--no-use-keyring` for a single invocation. When `true`, Wrangler stores OAuth credentials in an encrypted file with the encryption key held in the OS keychain, and exits with an error if the keychain backend is unavailable. When `false`, Wrangler uses the legacy plaintext TOML file even if the persistent preference is enabled. Refer to [Storing OAuth credentials in the OS keychain](/workers/wrangler/commands/general/#storing-oauth-credentials-in-the-os-keychain) for details.

@ask-bonk

ask-bonk Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review posted. Applied labels: documentation, product:workers, changelog.

5 inline suggestions posted.

Issues to address:

  • HIGH — Broken internal links in changelog/workers/2026-06-03-wrangler-keyring-credential-storage.mdx:31 and system-environment-variables.mdx:59. Both link to /workers/wrangler/commands/#... which resolves to the navigation index page, not the general commands page where the heading lives. They should use /workers/wrangler/commands/general/#....

  • MEDIUM — Inconsistent verb form in commands/general.mdx:50. The --use-keyring description starts with imperative "Store", but the surrounding flag descriptions use third-person "Sets" / "Defaults". It should be "Stores" for consistency.

  • MEDIUM — Possessive for inanimate objects in changelog/...mdx:9, commands/general.mdx:50, and commands/general.mdx:118. The style guide says to avoid possessives for inanimate objects: use "operating system keychain" instead of "operating system's keychain".

No pre-existing issues in the surrounding files were flagged.

github run

@github-actions

Copy link
Copy Markdown
Contributor

Hey there, we've marked this pull request as stale because there's no recent activity on it. This label helps us identify PRs that might need updates (or to be closed out by our team if no longer relevant).

@github-actions github-actions Bot added the stale label Jun 18, 2026
@petebacondarwin petebacondarwin force-pushed the pbd/wrangler-keyring-credential-storage branch from ad8ba94 to 1b1c85a Compare June 18, 2026 09:47
- Fix broken anchor links: point to commands/general/ instead of commands/
- Use third-person 'Stores' for --use-keyring to match other flag descriptions
- Drop possessive on 'operating system keychain' per style guide
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog Adds or updates changelog entries/pages. documentation Documentation edits product:changelog product:workers Related to Workers product size/s stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants