Skip to content

API permission issues with personal access tokens #2006

Closed

Description

@jjlin

I'm trying to delete some image tags via the Docker Hub REST API, since AFAIK, the Docker CLI doesn't support this operation. I get a JWT using the method described at https://success.docker.com/article/how-do-i-authenticate-with-the-v2-api. However, if I use a personal access token as the password for getting the JWT, then calling

curl -sS -X DELETE \
         -H "Authorization: Bearer ${jwt}" \
         "https://hub.docker.com/v2/repositories/${repo}/tags/${tag}/"

returns a 403 error with message

{"detail": "access to the resource is forbidden with personal access token"}

It works fine if I get the JWT using the actual account password.

Is there a particular reason for this restriction against personal access tokens? It seems like it would also break users who have 2FA enabled on Docker Hub.

Activity

  1. manishtomar commented on Jun 15, 2020

    @manishtomar

    Personal access token is restricted to registry APIs only (docker login). It does not allow accessing all APIs because doing that will bypass 2nd factor when an account is 2FA enabled. We want to eventually add fine-grained permission associated with each token similar to Github.

  2. manishtomar commented on Jun 15, 2020

    @manishtomar

    I've created roadmap item that addresses this. docker/roadmap#115. I am closing this for now. Please consider upvoting that.

  3. christian-kreuzberger-dtx commented on Dec 3, 2020

    @christian-kreuzberger-dtx

    I'm trying to automate deleting old unused tags (created by the CI) and ran into the same issue.

    So the only workaround for now is to use my username and actual password and disable 2FA?

  4. zhangguanzhang commented on Jul 13, 2022

    @zhangguanzhang

    same issue in github action, but works on my pc 😢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions