개인 액세스 토큰 수정

개인 액세스 토큰 수정 (Update personal access token)

Docker Hub API에서 개인 액세스 토큰(personal access token)을 부분 수정하는 작업이에요. 토큰의 라벨을 바꾸거나 활성/비활성을 전환할 수 있어요.

출처: 문서

본문

PATCH 요청으로 개인 액세스 토큰을 부분 수정합니다. bearerAuth 인증이 필요해요. 수정 대상은 토큰의 라벨 또는 활성화 여부예요.

파라미터

파라미터 위치 설명
uuid path (필수) 수정할 토큰의 UUID

요청 본문

patchAccessTokenRequest 스키마로, 예를 들면 이렇게 생겼어요.

{
  "is_active": false,
  "token_label": "My read only token"
}

응답 200

수정된 토큰 정보가 patchAccessTokenResponse로 돌아와요.

{
  "client_id": "HUB",
  "created_at": "2021-07-20T12:00:00.000000Z",
  "creator_ip": "127.0.0.1",
  "creator_ua": "some user agent",
  "expires_at": "2021-10-28T18:30:19.520861Z",
  "generated_by": "manual",
  "is_active": true,
  "last_used": null,
  "scopes": [
    "repo:read"
  ],
  "token": "***",
  "token_label": "My read only token",
  "uuid": "b30bbf97-506c-4ecd-aabc-842f3cb484fb"
}

오류 응답

  • 400: 잘못된 요청 (bad request)
  • 401: 인증 실패 (unauthorized)

예시 요청

curl \
  --request PATCH \
  --header "Authorization: Bearer ***" \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "is_active": false,
  "token_label": "My read only token"
}' \
  'https://hub.docker.com/v2/access-tokens/<UUID>'

더 알아보기