Skip to content

ci: strip forced placeholder token so npm publish uses OIDC - #7

Merged
planadecu merged 1 commit into
mainfrom
fix/oidc-clean-npmrc
Jul 13, 2026
Merged

ci: strip forced placeholder token so npm publish uses OIDC#7
planadecu merged 1 commit into
mainfrom
fix/oidc-clean-npmrc

Conversation

@planadecu

Copy link
Copy Markdown
Owner

Third follow-up. The run log revealed the real blocker: setup-node's .npmrc ($NPM_CONFIG_USERCONFIG) sets always-auth=true alongside a placeholder _authToken (NODE_AUTH_TOKEN: XXXXX-...). That forces npm to authenticate with the fake token on every request → E404, never reaching the OIDC exchange.

Fix: before publishing, overwrite that .npmrc with only registry=https://registry.npmjs.org/. With no token present, npm (≥ 11.5.1) authenticates via the OIDC id-token exchange (trusted publishing). Added npm --version to confirm the version.

If this still 404s, the remaining suspect is the Trusted Publisher config on npm (repo/workflow-filename mismatch) — but this removes the last token-shadowing issue on our side.

The setup-node .npmrc sets always-auth=true with a placeholder _authToken,
which forced npm to publish with the fake token (E404) instead of doing the
OIDC exchange. Overwrite that .npmrc with only the registry line so npm has
no token and authenticates via OIDC trusted publishing. Also log npm --version.
@planadecu
planadecu merged commit 76ce11c into main Jul 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant