-
Notifications
You must be signed in to change notification settings - Fork 41
Description
I have an internal service that returns the list of private repositories and tags associated with an org on docker hub for selection in our webapp.
I am able to use a PAT to generate a bearer token. However, I would prefer to use an OAT for all of the same benefits listed here: https://www.docker.com/blog/introducing-organization-access-tokens/.
My current approach is to send an HTTP POST request to the /users/login
endpoint.
curl -X POST https://hub.docker.com/v2/users/login \
-H "Content-Type: application/json" \
-d '{"username": "'$DOCKER_HUB_USERNAME'", "password": "'$DOCKER_HUB_PASSWORD'"}'
With a username and a PAT, this returns a valid response containing a bearer token that I can use to access https://hub.docker.com/v2/repositories/{org_name}
With an OAT, this call returns {"detail":"Cannot log into an organization account"}
.
I'm able to use docker login -u $ORG_NAME
and the OAT works for the login. I've tried also using the OAT directly as the Bearer token (header: {"Authorization": "Bearer <OAT>"}
), but this doesn't seem to work either.
Is there a way to migrate this use case to an OAT? Or is this not yet supported?