@cloudflare/workers-auth
0.18.6 · 20 Nov 2026MIT OR Apache-2.0565.1k / weekRepositoryHomepagenpmAtom feed
0.18.6 is the newest release of 0.1.x.
In short
3 fixed1 internal
Release note
Patch Changes
Extract the OAuth 2.0 + PKCE flow into a new
@cloudflare/workers-authpackage.The OAuth login / logout / refresh logic, the auth-config TOML file IO, the OAuth token exchange + local callback server, and the Cloudflare Access detection helpers that previously lived in
packages/wrangler/src/user/have moved to the new internal-only@cloudflare/workers-authpackage. Wrangler now wires the OAuth flow up via a small glue module that injects its logger, browser opener, interactivity detector, and config cache via a dependency- injection context.What stays in wrangler:
The yargs
login/logout/whoami/auth tokencommandsEnvironment-based credential resolution (
CLOUDFLARE_API_TOKEN,CLOUDFLARE_API_KEY/CLOUDFLARE_EMAIL, etc.)Cloudflare account selection (
requireAuth,getOrSelectAccountId)The OAuth scope catalog (passed into the OAuth flow as a generic
string)whoami/ account fetching
No behavior change for end users. The on-disk TOML format and location remain identical, and all telemetry message labels are preserved verbatim.
@cloudflare/workers-authis published withprerelease: trueand is not intended for external use — its APIs may change without notice.Tighten on-disk permissions of the OAuth credentials file to
0600The user auth config file written by
wrangler login(typically~/.config/.wrangler/config/default.tomlon Linux/macOS, or<environment>.tomlfor non-production Cloudflare API environments) is now written with mode0600and re-chmod-ed on every save. This prevents other local users on shared hosts from reading the stored OAuth tokens. Existing files with looser permissions written by older Wrangler versions are tightened the next time Wrangler refreshes the token or the user logs in again. The change is a no-op on Windows, which does not honour POSIX mode bits.Show the actual OAuth error instead of hanging when
wrangler loginis rejected by the OAuth provider (for example withinvalid_scope).Previously, if the OAuth callback returned with an
errorother thanaccess_denied, Wrangler would never respond to the browser. Becauseserver.close()'s callback only fires once all open connections have ended, the login command would hang until the 120 second OAuth timeout — at which point it would print a generic timeout message rather than the actual OAuth failure. The same gap existed for the case where the OAuth provider redirected back without an authorisation code, and for failures during the auth-code-to-access-token exchange.The OAuth provider's
error_description(RFC 6749 §4.1.2.1) is now also surfaced, so the message includes the specific reason for the failure rather than just the bareerrorcode. For example, a misconfigured staging scope now surfaces as:OAuth error: invalid_scope The OAuth 2.0 Client is not allowed to request scope 'browser:write'.
instead of hanging silently.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.