docker / hub-feedback

Feedback and bug reports for the Docker Hub
https://hub.docker.com
233 stars 40 forks source link

API login returns Unauthorized with personal access token #2166

Closed aldobongio closed 2 years ago

aldobongio commented 2 years ago

Hello, starting from today we are getting an unauthorized error (401) trying to perform an API login using a personal access token. To replicate:

  1. Login on hub.docker.com using a regular user and its main password
  2. Profile > Account Settings > Security > New Access Token (with any permission - seems unrelated to the problem) > Copy the access token

Open a shell where the Docker CLI is installed. The following works perfectly:

- docker logout #cleanup of old credentials (if any)
- docker login # provide the username and the main password ==> login succeeded
- docker logout
- docker login # provide the username and the Access Token ==> login succeeded

Now open a Linux environment with curl available:

curl -s -H "Content-Type: application/json" -X POST -d '{"username": "<USERNAME>", "password": "<MAIN_PASSWORD>"}' https://hub.docker.com/v2/users/login/
{"token": "..."}

curl -s -H "Content-Type: application/json" -X POST -d '{"username": "<USERNAME>", "password": "<ACCESS_TOKEN>"}' https://hub.docker.com/v2/users/login/
{"detail": "unauthorized"}

Until yesterday the API invocation using the personal access token as password worked perfectly. Today is not working. And is forcing us to store in our CI/CD environment the master password of the user responsible of reading/writing the Docker Hub registry, like in the pre-access-token era.

Additional information: my main Docker Hub user is the owner of an organization with a paid Docker Team plan. The organization also include an additional Docker Hub user as member. But the problem is unrelated to the user: today the API login can't be performed neither with the owner username (and its own personal acccess token) nor with the member username (and its own personal access token). Again, the Docker CLI login worked and continue to work without issues.

ingshtrom commented 2 years ago

cc @technicallyjosh. Maybe due to a recent deployment?

[edit]: might actually be an incident we are actively working on: https://status.docker.com/

aldobongio commented 2 years ago

I can confirm that now it works. Thanks.

bwateratmsft commented 2 years ago

Verified with the Docker extension for VSCode as well. Thanks for helping us find this @aldobongio!

technicallyjosh commented 2 years ago

Yup sorry I missed the comment. All is patched and working again!