You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using personal access token with Dockerhub API Beta #2127
When trying to use the Dockerhub beta API, such as this endpoint: /v2/namespaces/{namespace}/repositories/{repository}/images,
I used the authentication method through Personal Access Tokens as introduced in the docs. That is, I created a JWT using the authentication endpoint in this section and with the personal access token instead of the password in the password field. I was able to get a JWT in return, however, when I use it to get details about the images, I got this error:
{
"message": "access to the resource is forbidden with personal access token"
}
I'm confused if the personal access token is an acceptable mode of authentication? This is not clear in the docs.
Apologies, that sounds like a gap in the docs. PATs are not currently supported for API operations, but this is something we are looking to implement in future.
To add on, the docs now are even more misleading, because this is under the section of "Create an authentication token":
It says PAT can be used to authenticate with but I still get forbidden access to resource.
Apologies, that sounds like a gap in the docs. PATs are not currently supported for API operations, but this is something we are looking to implement in future.
PATs are not currently supported for API operations, but this is something we are looking to implement in future. @mikeparker Any tentative timeline for this to be implemented
We are clearing up our old issues and your ticket has been open for 6 months with no activity. Remove stale label or comment or this will be closed in 15 days.
I think something to help this confusion on the error message is to return something like "access to the resource is forbidden with an access token generated from a PAT". As far as the API access, this was bumped my way and should be fairly simple to patch in since it is a repo scoped call. (Right now PATs only have repo scopes). We can definitely look into allowing for PAT generated JWTs to access this resource with the repo:read scope.
👋🏼 You can now use a properly scoped JWT generated from a PAT on these image management routes. Changes to the wording should be updated within the next week.
Reacted by modem7, Christian Korneck and Becca Qiu
{
"detail": "access is forbidden with a JWT issued from a personal access token"
}
(The same example works if I use a password to create the JWT instead of a PAT)
Do you have any idea what I might be doing wrong? I highly appreciate any pointer into the right direction. (I assume it must be some stupid mistake on my side)?
We are rolling out personal access token support across endpoints as we speak. The PATCH repository endpoint was rolled out today with support for admin scoped PATs. Could you ensure your PAT has admin scope and test again for me?
We are rolling out personal access token support across endpoints as we speak. The PATCH repository endpoint was rolled out today with support for admin scoped PATs. Could you ensure your PAT has admin scope and test again for me?
Thanks
I used the Read, Write, Delete, but does not work for me.
@zhangguanzhang that appears to be a DELETE tag operation rather than a PATCH repo. Deleting a tag has not yet been migrated over so does not currently have PAT support (it's next on the list). Does PATCH repo work for you now?
@zhangguanzhang that appears to be a DELETE tag operation rather than a PATCH repo. Deleting a tag has not yet been migrated over so does not currently have PAT support (it's next on the list). Does PATCH repo work for you now?
How to delete a tag use the api 😢,I just want to delete a tag
@zhangguanzhang unfortunately for now you would have to use a password. I will prioritize getting the DELETE tag flow migrated over to use the new authentication flows and support PATs ASAP. Sorry for the inconvenience
@zigarn that's correct. URL data encoding is no longer supported. If this is a feature you want please could you open a new ticket? This one is getting a little full. Thanks
@zappy-shu thanks 🙇 a lot also for this also from my side! Updating the repo settings now seems to work fine. 🚀 (At a first look my "Docker Push Readme" Tool now seems to work with PATs without any change necessary).
Btw. I didn't need to create an admin scope PAT. Creating a read/write PAT from the Docker Hub WebUI seems to be sufficient.
Activity
mikeparker commentedon Jul 23, 2021
Apologies, that sounds like a gap in the docs. PATs are not currently supported for API operations, but this is something we are looking to implement in future.
qbiqing commentedon Jul 26, 2021
@mikeparker thanks, good to know! It would be really useful for apps using the Dockerhub API.
qbiqing commentedon Jul 30, 2021
To add on, the docs now are even more misleading, because this is under the section of "Create an authentication token":

It says PAT can be used to authenticate with but I still get forbidden access to resource.
mikeparker commentedon Jul 30, 2021
@qbiqing you're absolutely right, the docs are misleading here. I'll get this fixed. Sorry again.
modem7 commentedon Aug 14, 2021
@mikeparker I thought that docker/roadmap#115 was supposed to have been rolled out for this very purpose?
modem7 commentedon Aug 31, 2021
Is there any updates on this?
There doesn't seem to be much of a point to 2fa if you're unable to upload something as simple as a readme file.
srbala commentedon Sep 19, 2021
github-actions commentedon Mar 19, 2022
We are clearing up our old issues and your ticket has been open for 6 months with no activity. Remove stale label or comment or this will be closed in 15 days.
modem7 commentedon Mar 19, 2022
Stalebot bump
dotjoshrc commentedon Mar 19, 2022
I think something to help this confusion on the error message is to return something like "access to the resource is forbidden with an access token generated from a PAT". As far as the API access, this was bumped my way and should be fairly simple to patch in since it is a repo scoped call. (Right now PATs only have repo scopes). We can definitely look into allowing for PAT generated JWTs to access this resource with the
repo:readscope.dotjoshrc commentedon Mar 19, 2022
I've opened a PR to allow for image management route usage with PAT generated JWTs in our APIs. We can address the verbiage on the 403 this week.
dotjoshrc commentedon Mar 29, 2022
👋🏼 You can now use a properly scoped JWT generated from a PAT on these image management routes. Changes to the wording should be updated within the next week.
dotjoshrc commentedon Mar 29, 2022
I'll close this out. Thank you for leaving the feedback! Sorry it took a while to get to!
15 remaining items
zhangguanzhang commentedon Jul 13, 2022
same issue @milosgajdos PATL 👀
zappy-shu commentedon Jul 13, 2022
Good afternoon @zhangguanzhang
We are rolling out personal access token support across endpoints as we speak. The PATCH repository endpoint was rolled out today with support for
adminscoped PATs. Could you ensure your PAT hasadminscope and test again for me?Thanks
zhangguanzhang commentedon Jul 13, 2022
I used the
Read, Write, Delete, but does not work for me.or used the jwt
if I used the password for
repo_token, It workszappy-shu commentedon Jul 13, 2022
@zhangguanzhang could you do a verbose curl and list the response headers for me? And give me the time/date that you make the call. Thank you
zhangguanzhang commentedon Jul 13, 2022
I updated the previous comment with more details
zappy-shu commentedon Jul 13, 2022
@zhangguanzhang that appears to be a
DELETE tagoperation rather than aPATCH repo. Deleting a tag has not yet been migrated over so does not currently have PAT support (it's next on the list). DoesPATCH repowork for you now?zhangguanzhang commentedon Jul 13, 2022
How to delete a tag use the api 😢,I just want to delete a tag
zigarn commentedon Jul 13, 2022
My test executing the code from https://circleci.com/developer/orbs/orb/circleci/docker#commands-update-description to update description:
Looking at documentation, looks like x-www-form-urlencoded is not supported (anymore?).
=> Works 🚀
zappy-shu commentedon Jul 13, 2022
@zhangguanzhang unfortunately for now you would have to use a password. I will prioritize getting the DELETE tag flow migrated over to use the new authentication flows and support PATs ASAP. Sorry for the inconvenience
zappy-shu commentedon Jul 13, 2022
@zigarn that's correct. URL data encoding is no longer supported. If this is a feature you want please could you open a new ticket? This one is getting a little full. Thanks
zigarn commentedon Jul 13, 2022
@zappy-shu It's OK for me, just need to update https://circleci.com/developer/orbs/orb/circleci/docker#commands-update-description
christian-korneck commentedon Jul 13, 2022
@zappy-shu thanks 🙇 a lot also for this also from my side! Updating the repo settings now seems to work fine. 🚀 (At a first look my "Docker Push Readme" Tool now seems to work with PATs without any change necessary).
Btw. I didn't need to create an
adminscope PAT. Creating aread/writePAT from the Docker Hub WebUI seems to be sufficient.fix: Update DockerHub API
reitzig commentedon Jul 2, 2023
Extending on what @zigarn posted (thank you!), I needed to upload Markdown instead of a file name. I used to use this:
which does not work anymore. Now I need to encode the file content as JSON:
Seems to work!
Credits for the usage of
jq: SO#50380697fix: Update DockerHub API