hcp auth print-access-token

hcp auth print-access-token

hcp auth print-access-token 명령은 현재 인증된 계정의 접근 토큰을 출력할 때 사용해요. 이 글에서는 사용법과 API 요청 시 토큰을 활용하는 방법을 설명해 드릴게요.

출처: 문서

본문

명령: hcp auth print-access-token

hcp auth print-access-token 명령은 현재 인증된 계정의 접근 토큰을 출력해요.

이 명령의 출력은 API 요청을 수동으로 만들 때 `Authorization: Bearer *** HTTP 헤더를 설정하는 데 사용할 수 있어요.

사용법 (Usage)

$ hcp auth print-access-token [Optional Flags]

예시 (Examples)

접근 토큰을 출력해요.

$ hcp auth print-access-token

curl로 API를 호출할 때 접근 토큰을 사용해요.

$ curl https://api.cloud.hashicorp.com/iam/2019-12-10/caller-identity \
  --header "Authorization: Bearer *** auth print-access-token)"

더 알아보기 (Learn more)

  • hcp auth — 인증 명령 그룹 전체를 살펴볼 수 있어요.
  • hcp auth login — HCP에 로그인하는 방법을 살펴볼 수 있어요.
  • hcp auth logout — 로그아웃하는 방법을 살펴볼 수 있어요.