Skip to content

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

Open
petebacondarwin wants to merge 1 commit into
productionfrom
pbd/wrangler-keyring-credential-storage
Open

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

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

@petebacondarwin petebacondarwin commented Jun 3, 2026

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
Copy link
Copy Markdown

cloudflare-docs-bot Bot commented Jun 3, 2026

Review

❌ Review failed for commit ad8ba94. This is usually a transient error — it will retry on the next push.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 3, 2026

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

Copy link
Copy Markdown
Contributor

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

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
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk Bot left a comment

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
Copy link
Copy Markdown
Contributor

ask-bonk Bot commented Jun 3, 2026

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants