Error 401 unable to authenticate, your authentication token seems to be invalid
See original GitHub issueDescribe the bug
Authentication seems to be broken. I’m not sure what’s happened here, I didn’t update verdaccio, but it’s broken for all versions of npm, so is this an npm issue or a verdaccio issue?
Updating verdaccio to 4.2.2 hasn’t fixed it.
To Reproduce
$ npm i
npm ERR! code E401
npm ERR! Unable to authenticate, your authentication token seems to be invalid.
npm ERR! To correct this please trying logging in again with:
npm ERR! npm login
$ npm show @wd/build
npm ERR! code E401
npm ERR! Unable to authenticate, your authentication token seems to be invalid.
npm ERR! To correct this please trying logging in again with:
npm ERR! npm login
Expected behavior
I expect all of the above to work without authentication errors!
Docker || Kubernetes (please complete the following information):
- Docker verdaccio tag: verdaccio:4.2.2
- Docker Version v18.09.5
Configuration File (cat ~/.config/verdaccio/config.yaml)
storage: /verdaccio/storage
plugins: /verdaccio/plugins
auth:
htpasswd:
file: /verdaccio/conf/htpasswd
# prevent registration of new users
#max_users: -1
web:
# WebUI is enabled as default, if you want disable it, just uncomment this line
#enable: false
title: Verdaccio
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
# access/publish default to none
'@wd/*':
access: $authenticated
publish: simon
storage: /verdaccio/local_storage
'@*/*':
access: $authenticated
# no publish
proxy: npmjs
'**':
access: $authenticated
# no publish
proxy: npmjs
# To use `npm audit` uncomment the following section
middlewares:
audit:
enabled: true
logs:
- {type: stdout, format: pretty, level: debug}
Environment information
Verdaccio 4.2.2 (docker)
Environment Info:
System:
OS: Linux 4.9 Alpine Linux undefined
CPU: (8) x64 Intel(R) Xeon(R) CPU D-1520 @ 2.20GHz
Binaries:
Node: 10.16.3 - /usr/local/bin/node
Yarn: 1.17.3 - /usr/local/bin/yarn
npm: 6.9.0 - /usr/local/bin/npm
Debugging output
$ npm -ddd
prints:
$ npm adduser -ddd --registry=http://npm.systemparadox.co.uk --scope=@wd --always-auth
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli '/home/simon/npm/bin/npm',
npm verb cli 'adduser',
npm verb cli '-ddd',
npm verb cli '--registry=http://npm.systemparadox.co.uk',
npm verb cli '--scope=@wd',
npm verb cli '--always-auth' ]
npm info using npm@6.3.0
npm info using node@v10.15.2
npm verb npm-session 29208124d9c53929
npm verb web login before first POST
npm http request → POST http://npm.systemparadox.co.uk/-/v1/login
npm http 404 ← Not Found (http://npm.systemparadox.co.uk/-/v1/login)
npm verb web login not supported, trying couch
Username: simon
Password:
Email: (this IS public) simon@systemparadox.co.uk
npm verb login before first PUT { _id: 'org.couchdb.user:simon',
npm verb login name: 'simon',
npm verb login password: 'XXXXX',
npm verb login type: 'user',
npm verb login roles: [],
npm verb login date: '2019-08-28T15:55:20.128Z' }
npm http request → PUT http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon
npm http 409 ← Conflict (http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon)
npm http request → GET http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon?write=true
npm http 200 ← OK (http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon?write=true)
npm http request → PUT http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon/-rev/undefined
npm http 201 ← Created (http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon/-rev/undefined)
npm info login Authorized user simon
Logged in as simon to scope @wd on http://npm.systemparadox.co.uk/.
npm verb exit [ 0, true ]
npm timing npm Completed in 15742ms
npm info ok
$ npm login -ddd --registry=http://npm.systemparadox.co.uk
npm info it worked if it ends with ok
npm verb cli [ '/usr/bin/node',
npm verb cli '/home/simon/npm/bin/npm',
npm verb cli 'login',
npm verb cli '-ddd',
npm verb cli '--registry=http://npm.systemparadox.co.uk' ]
npm info using npm@6.3.0
npm info using node@v10.15.2
npm verb npm-session ddf35b7c2e480eb7
npm verb web login before first POST
npm http request → POST http://npm.systemparadox.co.uk/-/v1/login
npm http 404 ← Not Found (http://npm.systemparadox.co.uk/-/v1/login)
npm verb web login not supported, trying couch
Username: simon
Password:
Email: (this IS public) simon@systemparadox.co.uk
npm verb login before first PUT { _id: 'org.couchdb.user:simon',
npm verb login name: 'simon',
npm verb login password: 'XXXXX',
npm verb login type: 'user',
npm verb login roles: [],
npm verb login date: '2019-08-28T15:55:44.911Z' }
npm http request → PUT http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon
npm http 409 ← Conflict (http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon)
npm http request → GET http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon?write=true
npm http 200 ← OK (http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon?write=true)
npm http request → PUT http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon/-rev/undefined
npm http 201 ← Created (http://npm.systemparadox.co.uk/-/user/org.couchdb.user:simon/-rev/undefined)
npm info login Authorized user simon
Logged in as simon on http://npm.systemparadox.co.uk/.
npm verb exit [ 0, true ]
npm timing npm Completed in 10265ms
npm info ok
$ npm show @wd/build
npm ERR! code E401
npm ERR! authorization required to access package @wd/build : @wd/build
$ npm config get registry
prints:https://registry.npmjs.org/
, but I’m using a custom for specific prefixes.~/.npmrc
:
prefix=/home/simon/npm
@wd:registry=http://npm.systemparadox.co.uk/
//npm.systemparadox.co.uk/:_authToken="[REDACTED]"
always-auth=true
Client environment
- node version 10.15.2
- npm version 6.30, 6.8.0, 6.9.0, 6.11.2 (same issue for all of them)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:7
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Unable to authenticate, your authentication token seems to be ...
I'd really appreciate any help. The error. npm ERR! code E401; npm ERR! Unable to authenticate, your authentication token seems to be invalid....
Read more >npm err! code e401 npm err! unable to authenticate ... - You.com
NPM ERR Code E401: Unable to authenticate, need: Bearer authorization ; E401 with a private ; npm registry after upgrading to ; npm...
Read more >NPM invalid auth token with public Artifacts feed
Hello,. I tried to upload a package on a public feed with npm but i receive a 401 response: npm ERR! code E401...
Read more >How to connect and authenticate to NPM feeds on Azure ...
Solving error E401 - unable to authenticate ... DO NOT TRY THE NPM LOGIN! It logs you in the npmjs.com website, not in...
Read more >The npm ERR! code E401 Nightmare!!! - Medium
This error. npm ERR! code E401 npm ERR! Incorrect or missing password. npm ERR! If you were trying to login, change your password,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Apologies, server log is attached (although you might want to update the template because I did follow it but the server log doesn’t seem to be in the list):
I’ve also checked back through our logs and it appears that verdaccio was updated inadvertently as part of fixing a docker issue. This was quite some time ago, but we haven’t published any packages since then so it’s possible everyone has been working from their local cache until now.
I have a similar issue.
When i use
npm login
it will create anauthToken
to my.npmrc
which does not work. If i manually configureusername
and_password
to my.npmrc
it will work as expected.I simply use
npm info
command for a package which hasaccess: $authenticated
for testing.I’m using npm / node on windows:
I always get ‘400 Bad Request’, but i don’t find it in the logs.
I’m using traefik v1.7 as proxy for the verdaccio docker container v4.3.3 As auth plugin i use bitbucket-server