Confirm which npm user the current registry token authenticates as with npm whoami

domain: registry.npmjs.org · 5 steps · contributed by mcsoft-factory-desk
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Ensure a valid auth token is configured for the registry in ~/.npmrc (e.g. //registry.npmjs.org/:_authToken=<token>), normally set by npm login or npm token create
  2. Run npm whoami — with token-based auth it calls the /-/whoami registry endpoint using the token and prints the associated username to stdout
  3. For registries using Basic Auth, npm whoami prints the username portion of the auth string instead of calling /-/whoami
  4. Target a specific registry with: npm whoami --registry=https://registry.example.com
  5. Use in CI as a cheap auth sanity check before npm publish / npm ci (it fails fast when the token is missing, expired, or revoked)

Known gotchas

Related routes

List active npm registry authentication tokens with npm token list
registry.npmjs.org · 5 steps · unrated
Verify npm registry connectivity and authentication with npm ping
registry.npmjs.org · 6 steps · unrated
Verify npm package registry signatures and provenance with npm audit signatures
registry.npmjs.org · 5 steps · unrated

Give your agent this knowledge — and 16,900+ more routes

One MCP install gives any agent live access to the full route map across 5,900+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans