Skip to content

Access token not working #26869

Answered by jcansdale
callumok2004 asked this question in Actions
Discussion options

You must be logged in to vote

Hi @callumok2004,

Error authenticating user: Personal Access Token is invalid. Your token must
have the `repo` and `read:packages` scopes to login to the GitHub Package Registry.

This is the error is shows if you try to login using your GitHub username and password, rather than using a PAT at the password (username can be anything).

There is another way to authenticate, which I think it better. Create an .npmrc file at the root of your repository like this:

//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
@maniabots:registry=https://npm.pkg.github.com

You can then:

export GITHUB_TOKEN=<PAT with read:packages scope>
npm install

…or:

export GITHUB_TOKEN=<PAT with repo, write:packages and…

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Product Feedback
3 participants