Skip to content

[BUG] npm access commands not sending auth token #6210

@DavidTanner

Description

@DavidTanner

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

After having set both the NPM_TOKEN environment variable, and running echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc, the npm access grant command fails with Unable to authenticate, need: bearer.

Issue appears to have been introduced by this commit.

Other commands work by sending ...this.npm.flatOptions, and this appears to be missing from the access commands.

Expected Behavior

The command should update the package with permissions for my team.

Steps To Reproduce

export NPM_TOKEN=''
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm access grant read-only ORG:GROUP '@ORG/PACKAGE'

Environment

  • npm: v9.5.1
  • Node.js: v18.14.1
  • OS Name: Linux 5.15.0-1033-azure
  • System Model Name: Ubuntu 22.04.2
  • npm config:
Run npm config ls
; "project" config from /home/runner/work/terminology-change-stream/terminology-change-stream/.npmrc

//registry.npmjs.org/:_authToken = (protected) 

; node bin location = /opt/hostedtoolcache/node/18.14.1/x64/bin/node
; node version = v18.14.1
; npm local prefix = /home/runner/work/terminology-change-stream/terminology-change-stream
; npm version = 9.5.1
; cwd = /home/runner/work/terminology-change-stream/terminology-change-stream
; HOME = /home/runner
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions