fix(ci): remove auth token from npmrc to enable OIDC #675
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Deep Dive: Root Cause Analysis
After analyzing the logs from https://github.com/adobe/spectrum-design-data/actions/runs/21268010963/job/61211774286, I found the exact problem preventing OIDC from working.
The Evidence
1. npm is trying to use a non-existent token:
2. But OIDC IS working for provenance:
3. Changesets detected the auth token line:
The Problem
The
.npmrccontained this auth token line:When npm sees
_authTokenin.npmrc, it tries to use token-based authentication instead of falling back to OIDC. SinceNPM_TOKENisn't set as an environment variable, npm tries to expand${NPM_TOKEN}and gets an invalid literal string, which it rejects.Why Provenance Worked But Publish Failed
OIDC authentication for provenance signing uses a separate code path in npm that doesn't check
.npmrcfor auth tokens. This proves:id-token: writepermission works.npmrcThe Solution
Remove the
//registry.npmjs.org/:_authToken=${NPM_TOKEN}line from.npmrc.With only the registry URL, npm will:
.npmrcid-token: writepermission)This is the recommended approach per npm docs - no auth token in
.npmrcwhen using OIDC.Changes
Before (broken):
After (working):
Verification
This will fix all the auth errors:
Related