Authentication
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 문서에서는 Ad Manager API에 인증하는 방법을 설명합니다. 인증 방법은 사용하는 인터페이스와 코드가 실행되는 환경에 따라 다르지만 모든 API 요청에는 Ad Manager API 범위의 액세스 토큰이 포함되어야 합니다.
Ad Manager 클라이언트 라이브러리는 애플리케이션 기본 사용자 인증 정보를 사용하여 Ad Manager API 범위로 액세스 토큰을 생성합니다. 이 가이드에서는 애플리케이션 기본 사용자 인증 정보를 구성하는 방법을 보여줍니다.
클라이언트 라이브러리를 사용하지 않는 경우에도 사용자 인증 정보를 만들어야 합니다.
요청을 승인하는 데 사용할 수 있습니다.
인증 및 승인에 대한 자세한 내용은 다음을 참조하세요.
OAuth 2.0 사용 가이드를 참조하세요.
인증 유형 확인
인증 유형 |
설명 |
서비스 계정
|
전용 계정으로 인증하려는 경우 선택하세요.
특정 사용자가 아닌
계정으로 보낼 수 있습니다
자세히 알아보기 |
웹 애플리케이션
|
애플리케이션에 Ad Manager 데이터에 액세스할 권한을 부여하는 사용자로 인증하려면 이 옵션을 선택합니다.
자세히 알아보기 |
로컬 개발
|
자체 인증으로 인증하려는 경우 선택하세요.
로컬의 Google 계정 또는 서비스 계정
개발 환경입니다. |
Ad Manager API 사용 설정
Ad Manager API를 사용 설정합니다.
Google API 콘솔 Cloud 프로젝트
메시지가 표시되면 프로젝트를 선택하거나 새 프로젝트를 만듭니다.
사용자 인증 정보 만들기
인증 유형 탭을 클릭하고 안내에 따라
사용자 인증 정보를 만듭니다.
서비스 계정
Google Cloud
Google Cloud에서 실행되는 워크로드를 인증하려면 코드가 실행 중인 컴퓨팅 리소스에 연결된 서비스 계정의 사용자 인증 정보를 사용합니다.
예를 들어 Compute Engine 가상 머신에 서비스 계정을
Cloud Run 서비스 또는 Dataflow 작업을 실행할 수도 있습니다 이 접근 방식
은 Google Cloud에서 실행되는 코드에 선호되는 인증 방법입니다.
컴퓨팅 리소스를 제공합니다
서비스 계정에 연결할 수 있는 리소스 및 리소스에 서비스 계정 연결에 대한 자세한 내용은 서비스 계정 연결에 관한 문서를 참고하세요.
온프레미스 또는 다른 클라우드 제공업체
Google Cloud 외부에서 인증을 설정하는 데 선호되는 방법은 워크로드 아이덴티티 제휴를 사용하는 것입니다. 사용자 인증 정보 구성 파일을 만들고 이를 가리키도록 GOOGLE_APPLICATION_CREDENTIALS
환경 변수를 설정합니다. 이 방법은 서비스 계정 키를 만드는 것보다 안전합니다.
워크로드 아이덴티티 제휴를 구성할 수 없는 경우 다음을 수행해야 합니다.
서비스 계정을 만들고 서비스 계정의 키를 만듭니다.
Google API 콘솔 사용자 인증 정보 페이지를 엽니다.
사용자 인증 정보 페이지에서 사용자 인증 정보 만들기를 선택한 다음
서비스 계정을 선택합니다.
키를 만들려는 서비스 계정의 이메일 주소를 클릭합니다.
키 탭을 클릭합니다.
키 추가 드롭다운 메뉴를 클릭한 후 새 키 만들기를 선택합니다.
키 유형으로 JSON을 선택하고 만들기를 클릭합니다.
환경 변수 GOOGLE_APPLICATION_CREDENTIALS
를 경로로 설정합니다.
JSON 파일의 링크입니다.
Linux 또는 macOS
export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
Windows
set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
웹 애플리케이션
Google API 콘솔 사용자 인증 정보 페이지를 엽니다.
메시지가 표시되면 Ad Manager API를 사용 설정한 프로젝트를 선택합니다.
사용자 인증 정보 페이지에서 사용자 인증 정보 만들기를 선택한 후 OAuth 클라이언트 ID를 선택합니다.
웹 애플리케이션 애플리케이션 유형을 선택합니다.
양식을 작성하고 만들기를 클릭합니다. PHP, Java, Python, Ruby, .NET과 같은 언어와 프레임워크를 사용하는 애플리케이션은 승인된 리디렉션 URI를 지정해야 합니다. 리디렉션 URI는 OAuth 2.0 서버가 응답을 보낼 수 있는 엔드포인트입니다. 이러한 엔드포인트는 Google
검증 규칙을 참조하세요.
사용자 인증 정보를 만든 후 client_secret.json 파일을 다운로드합니다. 내 애플리케이션만 액세스할 수 있는 위치에 파일을 안전하게 저장합니다.
여기에서 OAuth 2.0 액세스 토큰을 가져오는 단계를 따릅니다.
로컬 개발
로컬 환경에서 애플리케이션 기본 사용자 인증 정보 (ADC)를 설정합니다.
Google Cloud CLI를 설치한 후 다음 명령어를 실행하여 초기화합니다.
gcloud init
Google 계정에 대한 로컬 사용자 인증 정보를 만들고
Ad Manager API가 사용 설정된 프로젝트에 프로젝트 ID를 추가합니다.
gcloud auth application-default login --scopes="https://www.googleapis.com/auth/admanager"
gcloud auth application-default set-quota-project PROJECT_ID
또는 환경 변수 GOOGLE_APPLICATION_CREDENTIALS
를 키 파일의 경로로 설정하여 서비스 계정으로 인증합니다.
Linux 또는 macOS
export GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
Windows
set GOOGLE_APPLICATION_CREDENTIALS=KEY_FILE_PATH
서비스 계정
- Ad Manager 네트워크로 이동합니다.
- 관리 탭을 클릭합니다.
- API 액세스가 사용 설정되어 있는지 확인합니다.
- 서비스 계정 사용자 추가 버튼을 클릭합니다.
- 서비스 계정 이메일을 사용하여 양식을 작성합니다. 이
서비스 계정 사용자를 적절한 역할 및 팀에 추가해야 함
살펴보겠습니다
- 저장 버튼을 클릭합니다. 메시지가 표시되어
서비스 계정을 추가할 수 있습니다
- 사용자 탭으로 이동한 다음 서비스 계정 필터를 클릭하여 기존 서비스 계정 사용자를 확인합니다.
클라이언트 라이브러리 사용 안 함
클라이언트 라이브러리를 사용하지 않는 경우에도
인증을 위한 OAuth2 라이브러리를 제공합니다
액세스 토큰을 가져오는 방법에 관한 자세한 안내는 Google API에서 OAuth2 사용하기를 참고하세요.
액세스 토큰
다음 중 하나를 포함하여 API 요청에 액세스 토큰을 포함합니다.
access_token
쿼리 매개변수 또는 Authorization
HTTP 헤더 Bearer
값입니다.
가능하면 HTTP 헤더를 사용하는 것이 좋습니다. 쿼리 문자열은 서버 로그에 표시되는 경향이 있기 때문입니다.
예를 들면 다음과 같습니다.
GET /v1/networks/1234
Host: admanager.googleapis.com
Authorization: Bearer ya29.a0Ad52N3_shYLX
GET https://admanager.googleapis.com/v1/networks/1234?access_token=1/fFAGRNJru1FTz70BzhT3Zg
범위
각 액세스 토큰은 하나 이상의 범위와 연결됩니다. 범위는 액세스 토큰이 허용하는 리소스 및 작업 집합을 제어합니다. Ad Manager
API에는 범위가 1개만 있습니다. 사용자가 인증해야 합니다.
설정할 수 있습니다
범위 |
권한 |
https://www.googleapis.com/auth/admanager
|
Google Ad Manager에서 캠페인을 확인하고 관리합니다. |
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eGoogle Ad Manager API authentication depends on the interface and environment but always requires an access token.\u003c/p\u003e\n"],["\u003cp\u003eChoose between service account, web application, or local development authentication based on your needs.\u003c/p\u003e\n"],["\u003cp\u003eEnable the Ad Manager API in your Google API Console and create the necessary credentials for your chosen authentication type.\u003c/p\u003e\n"],["\u003cp\u003eConfigure your Ad Manager network settings and add the service account user or enable API access depending on authentication type.\u003c/p\u003e\n"],["\u003cp\u003eInclude your access token in API requests using either a query parameter or an HTTP header.\u003c/p\u003e\n"]]],["To access the Ad Manager API, you need an access token, generated using Application Default Credentials (ADC) or custom credentials. First, enable the Ad Manager API in your Google Cloud project. Then, choose an authentication type: Service Account, Web application, or Local development. Create credentials via the Google API Console, selecting the appropriate method. If not using a client library, use an OAuth2 library. Finally, include the access token in API requests, preferably in the `Authorization` HTTP header. Each access token should be associated with the `https://www.googleapis.com/auth/admanager` scope.\n"],null,["# Authentication\n\nThis document describes how to authenticate to the Ad Manager API. How you\nauthenticate depends on the interface you use and the environment where your\ncode is running, but all API requests must include an access token with the\nAd Manager API [scope](#scope).\n\nThe Ad Manager client libraries use [Application Default Credentials](//cloud.google.com/docs/authentication/application-default-credentials)\nto generate access tokens with the Ad Manager API scope. This guide shows\nhow to configure Application Default Credentials.\n\nIf you aren't using a client library, you still need to create credentials\nand use them to authorize your requests.\n\nFor more information about authentication and authorization, see the\n[Using OAuth 2.0](/identity/protocols/oauth2) guide.\n\nDetermine your authentication type\n----------------------------------\n\n| Authentication type | Description |\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Service Account | Choose this if you want to authenticate as dedicated account rather than a particular person. [Learn more](//cloud.google.com/iam/docs/service-account-overview). |\n| Web application | Choose this if you want to authenticate as any user who grants permission to your application to access their Ad Manager data. [Learn more](/identity/oauth2/web/guides/overview) |\n| Local development | Choose this if you want to authenticate as your own Google Account or a Service Account from your local development environment. |\n\nEnable the Ad Manager API\n-------------------------\n\n1. Enable the [Ad Manager API](https://console.cloud.google.com/apis/library/admanager.googleapis.com) in your\n Google API Console Cloud Project.\n\n2. If prompted, select a project, or create a new one.\n\nCreate credentials\n------------------\n\nClick the tab for your authentication type and follow the instructions to\ncreate your credentials: \n\n### Service Account\n\n### On Google Cloud\n\nTo authenticate a workload running on Google Cloud, you use the credentials of\nthe service account attached to the compute resource where your code is\nrunning.\n\nFor example, you can attach a service account to a Compute Engine virtual\nmachine (VM) instance, a Cloud Run service, or a Dataflow job. This approach\nis the preferred authentication method for code running on a Google Cloud\ncompute resource.\n\nFor information about which resources you can attach a service account to,\nand help with attaching the service account to the resource, see the\n[documentation on attaching a service account](//cloud.google.com/iam/docs/attach-service-accounts).\n\n### On-premises or on a different cloud provider\n\nThe preferred method to set up authentication from outside of Google Cloud is\nto use [workload identity federation](//cloud.google.com/iam/docs/workload-identity-federation); you create a\ncredential configuration file and set the `GOOGLE_APPLICATION_CREDENTIALS`\nenvironment variable to point to it. This approach is more secure than\ncreating a service account key.\n\nIf you are not able to configure workload identity federation, then you must\ncreate a service account and create a key for the service account:\n\n1. Open the [Google API Console Credentials page](https://console.cloud.google.com/apis/credentials).\n\n2. On the Credentials page, select **Create credentials** , then\n select **Service Account**.\n\n3. Click the email address of the service account that you want to create\n a key for.\n\n4. Click the **Keys** tab.\n\n5. Click the **Add key** drop-down menu, then select **Create new key**.\n\n6. Select **JSON** as the **Key type** and click **Create**.\n\n7. Set the environment variable `GOOGLE_APPLICATION_CREDENTIALS` to the path\n of the JSON file.\n\n#### Linux or macOS\n\n export GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\n#### Windows\n\n set GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\n### Web application\n\n1. Open the [Google API Console Credentials page](https://console.cloud.google.com/apis/credentials).\n\n2. If prompted, select the project where you enabled the Ad Manager API.\n\n3. On the Credentials page, select **Create credentials** , then\n select **OAuth client ID**.\n\n4. Select the **Web application** application type.\n\n5. Fill in the form and click **Create** . Applications that use languages and\n frameworks like PHP, Java, Python, Ruby, and .NET must specify authorized\n **redirect URIs** . The redirect URIs are the endpoints to which the OAuth 2.0\n server can send responses. These endpoints must adhere to [Google's\n validation rules](/identity/protocols/oauth2/web-server#uri-validation).\n\n6. After creating your credentials, download the **client_secret.json** file. Securely store the file in a location that only your application can access.\n\nFrom here, follow the steps to [obtain OAuth 2.0 access tokens](/identity/protocols/oauth2/web-server#obtainingaccesstokens)\n\n### Local development\n\nSet up Application Default Credentials (ADC) in your local environment.\n\nInstall the Google Cloud CLI, then initialize it by running the following\ncommand: \n\n gcloud init\n\nCreate local authentication credentials for your Google Account and set\nthe project ID to a project where the Ad Manager API is enabled: \n\n gcloud auth application-default login --scopes=\"https://www.googleapis.com/auth/admanager\"\n gcloud auth application-default set-quota-project \u003cvar label=\"project id\" translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\nAlternatively, authenticate as a Service Account setting the environment\nvariable `GOOGLE_APPLICATION_CREDENTIALS` to the path of your key file.\n\n#### Linux or macOS\n\n export GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\n#### Windows\n\n set GOOGLE_APPLICATION_CREDENTIALS=\u003cvar label=\"key file\" translate=\"no\"\u003eKEY_FILE_PATH\u003c/var\u003e\n\nConfigure your Ad Manager network\n---------------------------------\n\n**Tip:** If you are a third-party developer, ask your client to complete this step for you. Send them to [Add a service account user for API access](//support.google.com/admanager/answer/6078734) and provide the email address of your service account. \n\n### Service Account\n\n1. Go to your [Ad Manager network](//admanager.google.com).\n2. Click the **Admin** tab.\n3. Ensure that **API access** is enabled.\n4. Click the **Add a service account user** button.\n5. Fill in the form using the service account email. The service account user must be added to appropriate roles and teams for your API integration.\n6. Click the **Save** button. A message should appear, confirming the addition of your service account.\n7. View existing service account users by going to the Users tab and then clicking the **Service Account** filter.\n\n### Web application\n\n1. Go to your [Ad Manager network](//admanager.google.com).\n2. Click the **Admin** tab.\n3. Ensure that **API access** is enabled.\n\n### Local Development\n\n1. Go to your [Ad Manager network](//admanager.google.com).\n2. Click the **Admin** tab.\n3. Ensure that **API access** is enabled.\n\nWithout a client library\n------------------------\n\nIf you are not using a client library, we still strongly recommend using\nan OAuth2 library for authentication.\n\nFor detailed instructions on obtaining access tokens, see\n[Using OAuth2 with Google APIs](/identity/protocols/oauth2).\n\n### Access tokens\n\nInclude your access token in a request to the API by including either an\n`access_token` query parameter or an `Authorization` HTTP header `Bearer` value.\nWhen possible, the HTTP header is preferable, because query strings tend to be\nvisible in server logs.\n\nFor example: \n\n GET /v1/networks/1234\n Host: admanager.googleapis.com\n Authorization: Bearer ya29.a0Ad52N3_shYLX\n\n GET https://admanager.googleapis.com/v1/networks/1234?access_token=1/fFAGRNJru1FTz70BzhT3Zg\n\n### Scope\n\nEach access token is associated with one or more scopes. A scope controls the\nset of resources and operations that an access token permits. The Ad Manager\nAPI has only one scope. Authorization should be performed at the user\nlevel within the product.\n\n| Scope | Permissions |\n|---------------------------------------------|------------------------------------------------------|\n| `https://www.googleapis.com/auth/admanager` | View and manage your campaigns on Google Ad Manager. |"]]