Create access token Run in API Explorer
Creates and returns a short-lived access token in JWT format for use as a bearer when calling Docker APIs.
If successful, the access token returned should be used in the HTTP Authorization header like
Authorization: Bearer {access_token}
.
If your organization has SSO enforced, you must use a personal access token (PAT) instead of a password.
Body
-
The identifier of the account to create an access token for. If using a password or personal access token, this must be a username. If using an organization access token, this must be an organization name.
-
The secret of the account to create an access token for. This can be a password, personal access token, or organization access token.
POST
/v2/auth/token
curl \
--request POST 'https://hub.docker.com/v2/auth/token' \
--header "Content-Type: application/json" \
--data '{"identifier":"myusername","secret":"dckr_pat_124509ugsdjga93"}'
Request examples
{
"identifier": "myusername",
"secret": "dckr_pat_124509ugsdjga93"
}
Response examples (200)
{
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}
Response examples (401)
{
"errinfo": {},
"detail": "string",
"message": "string"
}