question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Download tarball" gives an error ("error: authorization required to access package") when authenticated

See original GitHub issue

When browsing the registry with Verdaccio’s webui and logged in with an authenticated account, the “Download tarball” link does not works and I get an HTTP 401 errror with the following message:

{
  "error": "authorization required to access package @acme/acme-foo"
}

However, the access with npm (and a logged in user) works correctly.

Here is the server log for npm install @acme/acme-corp:

  debug--- [local-storage/readTarball] read a tarball for package: acme-foo-1.2.0-RC.2019.1.3.tgz
  http <-- 200, user: client01(192.168.251.209), req: 'GET /@acme%2facme-foo/-/acme-foo-1.2.0-RC.2019.1.3.tgz', bytes: 0/48585

And here is the log when accessing the package with the webui and logged with user client01:

  info <-- 192.168.251.209 requested 'GET /@acme%2facme-foo/-/acme-foo-1.2.0-RC.2019.1.3.tgz'
  http <-- 401, user: null(192.168.251.209), req: 'GET /@acme%2facme-foo/-/acme-foo-1.2.0-RC.2019.1.3.tgz', error: authorization required to access package @acme/acme-foo

The HTTP request made by the webui seems to correctly have the Authorization: Bearer <token> header but the server log does not reports the request as being authenticated with user client01 and reports the user as null.

I’m using the htpasswd authentication plugin:

auth:
    htpasswd:
        file: data/conf/htpasswd
        max_users: -1

Here is the content of my packages: access control directive:

packages:
    '@acme/*':
        access: $authenticated
        publish: admin

If I set access: $all, then the “download tarball” link works in the webui.

I tried this on verdaccio v4.0.1 and v4.3.3, and both reports a HTTP 401 when downloading the package with the “Download tarball” link.

Does anyone else also noticed this error

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:8
  • Comments:31 (11 by maintainers)

github_iconTop GitHub Comments

6reactions
krzaczekcommented, May 2, 2020

I can confirm that adding security.api section with legacy: false and jwt to the config fixes the issue for me. Running 4.6.2 behind nginx reverse proxy. Thx @hdmr14 👍

3reactions
masterkaincommented, Mar 25, 2022
security:
  api:
    legacy: false
    jwt:
      sign:
        expiresIn: 29d

I can confirm that just adding this block the tarball download works (tested in brave) my web configuration just has the title key

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP 401 Error: Unknown authentication scheme when using ...
When I try to download a tarball of the repository (for an example to be specified as a dependency link in “setup.py” of...
Read more >
pip install using tarball archive from private gitlab repo using ...
Authenticating to GitLab. Your initial problem is that you can't authenticate with username and password using basic auth to the get archive ...
Read more >
Authentication methods | Container Registry documentation
This page describes how to configure a third-party client to authenticate with Container Registry. Google Cloud services that integrate with Container ...
Read more >
ARTIFACTORY: How to Download PyPI Packages Using Wget ...
Sometimes it becomes necessary to download the PyPI packages from the repositories that do not have anonymous access using the Wget command, ...
Read more >
Understand Web Authentication on Wireless LAN Controllers ...
Do not put your forced redirection URL there. For redirection issues in custom WebAuth, Cisco recommends to check the bundle. If you enter...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found