승인 및 인증
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
SAS Portal API와 통합할 때는 인증에 서비스 계정을 사용하는 것이 좋습니다. 필요한 경우
서비스 계정을 만듭니다.
서비스 계정 키를 만들 때 키 유형으로 JSON을 선택해야 합니다. 작업을 완료하면 서비스 계정 키가 브라우저의 기본 위치로 다운로드됩니다. 또한 서비스 계정에
'프로젝트 소유자' 역할을 부여해야 합니다.
다음으로 서비스 계정 인증을 Bearer 토큰으로 제공해야 합니다. cURL로 HTTP 요청을 수행하는 것과 같이 SAS Portal API를 직접 호출하는 경우 Authorization 헤더에 인증을 Bearer 토큰으로 전달합니다. 서비스 계정으로 Bearer 토큰을 가져오려면 다음 단계를 따르세요.
-
gcloud 명령줄 도구를 설치합니다.
-
서비스 계정에 인증합니다. 다음 명령어에서 ${KEY_FILE}을 서비스 계정 키 파일의 경로로 바꿉니다.
gcloud auth activate-service-account --key-file ${KEY_FILE}
-
서비스 계정을 사용하여 승인 토큰을 가져옵니다.
gcloud auth print-access-token
이 명령어는 액세스 토큰 값을 반환합니다.
-
API를 사용할 때는 Authorization 헤더에 토큰 값을 Bearer 토큰으로 전달합니다. 아래 예시를 참조하세요.
curl -X GET -H "X-Goog-User-Project: ${CLIENT_PROJECT}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${TOKEN}" \
"https://sasportal.googleapis.com/v1alpha1/customers"
${CLIENT_PROJECT}를 요청을 보내는
Google Cloud 프로젝트의 ID로 설정한 다음 ${TOKEN}를 승인 토큰으로 설정합니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-25(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-25(UTC)"],[],["The key actions are creating a service account with a JSON key, granting it the \"Project Owner\" role, and obtaining a Bearer token for API authentication. This is done by installing the `gcloud` tool, authenticating the service account using `gcloud auth activate-service-account --key-file`, and generating an access token via `gcloud auth print-access-token`. This token should then be included in the `Authorization` header when making API calls as a Bearer token.\n"]]