v1

latestOpenAPI 3.0.02026-07-14285059.6 KB
authentication

Second factor authentication.

When user has 2FA enabled, this is the second call to perform after /v2/users/login call.

Creates and returns a bearer token in JWT format that you can use to authenticate with Docker Hub APIs.

The returned token is used in the HTTP Authorization header like Authorization: Bearer {TOKEN}.

Most Docker Hub APIs require this token either to consume or to get detailed information. For example, to list images in a private repository.

post/v2/users/2fa-login

Request body

codestring required

The Time-based One-Time Password of the Docker Hub account to authenticate with.

login_2fa_tokenstring required

The intermediate 2FA token returned from /v2/users/login API.

Example request

{
  "login_2fa_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}

Response

Authentication successful

tokenstring

Created authentication token.

This token can be used in the HTTP Authorization header as a JWT to authenticate with the Docker Hub APIs.

Example response

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
}