단일 액세스 토큰은 여러 API에 다양한 수준의 액세스 권한을 부여할 수 있습니다. scope라는 가변 매개변수는 액세스 토큰이 허용하는 리소스 및 작업 집합을 제어합니다. 액세스 토큰 요청 중에 앱은 scope 매개변수에 하나 이상의 값을 전송합니다.
Google Ads API의 범위는 다음과 같습니다.
https://www.googleapis.com/auth/adwords
오프라인 액세스
Google Ads API 클라이언트 앱이 오프라인 액세스를 요청하는 것은 일반적입니다. 예를 들어 사용자가 웹사이트를 오프라인으로 탐색하지 않을 때 앱에서 일괄 작업을 실행할 수 있습니다.
웹 앱 유형의 오프라인 액세스를 요청하려면 access_type 매개변수를 offline로 설정해야 합니다. 자세한 내용은 Google의 OAuth2 가이드를 참고하세요.
데스크톱 앱 유형의 경우 오프라인 액세스가 기본적으로 사용 설정되므로 명시적으로 요청하지 않아도 됩니다.
요청 헤더
gRPC 헤더
gRPC API를 사용하는 경우 각 요청에 액세스 토큰을 포함하세요. 해당 채널의 모든 요청에 사용할 수 있도록 Credential를 Channel에 바인딩할 수 있습니다. 각 호출에 맞게 맞춤설정된 사용자 인증 정보를 보낼 수도 있습니다. gRPC 승인 가이드에는 승인 처리에 관한 자세한 내용이 포함되어 있습니다.
REST 헤더
REST API를 사용하는 경우 HTTP 헤더 Authorization를 통해 액세스 토큰을 전달합니다. HTTP 요청의 예는 다음과 같습니다.
액세스 토큰에는 토큰이 더 이상 유효하지 않은 후의 만료 시간 (expires_in 값을 기반으로 함)이 있습니다. 갱신 토큰을 사용하여 만료된 액세스 토큰을 갱신할 수 있습니다. 기본적으로 Google 클라이언트 라이브러리는 만료된 액세스 토큰을 자동으로 새로고침합니다.
[[["이해하기 쉬움","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-09-05(UTC)"],[[["\u003cp\u003eThis guide is for advanced users familiar with OAuth 2.0 and its use with Google APIs, offering behind-the-scenes details on authentication with the Google Ads API.\u003c/p\u003e\n"],["\u003cp\u003eAccess tokens control API access, determined by the 'scope' parameter, with the Google Ads API scope being \u003ccode\u003ehttps://www.googleapis.com/auth/adwords\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eOffline access is available for client apps; web apps require setting \u003ccode\u003eaccess_type\u003c/code\u003e to \u003ccode\u003eoffline\u003c/code\u003e, while desktop apps have it enabled by default.\u003c/p\u003e\n"],["\u003cp\u003eAccess tokens are passed via the \u003ccode\u003eAuthorization\u003c/code\u003e HTTP header for REST or bound to a \u003ccode\u003eChannel\u003c/code\u003e for gRPC, and can be refreshed using a securely stored refresh token.\u003c/p\u003e\n"],["\u003cp\u003eClient libraries automatically handle token refresh, but developers can consult guides for desktop and web app token management.\u003c/p\u003e\n"]]],[],null,["# OAuth2 Internals for Google Ads API\n\nOur client libraries automatically take care of the details covered below, so\ncontinue reading only if you're interested in what's happening behind the\nscenes, or if you're not using one of our client libraries.\n\nThis section is intended for advanced users who are already familiar\nwith the [OAuth 2.0 specification](//tools.ietf.org/html/rfc6749) and\nknow how to [use OAuth2 with Google APIs](/identity/protocols/oauth2).\n| **Note:** The Google Ads API does not currently support simultaneous signin with data access request (hybrid) or domain-wide delegation of authority (2LO).\n\n#### Want to learn more about authentication in the API?\n\n\nvideo_library\n[Video library: Authentication and Authorization](/google-ads/api/videos/catalog#authentication-authorization)\n\nScope\n-----\n\nA single access token can grant varying degrees of access to multiple APIs. A\nvariable parameter called `scope` controls the set of resources and operations\nthat an access token permits. During the access token request, your app\nsends one or more values in the `scope` parameter.\n\nThe scope for the Google Ads API is: \n\n https://www.googleapis.com/auth/adwords\n\nOffline access\n--------------\n\nIt's common for a Google Ads API client app to request offline access. For example,\nyour app may want to run batch jobs when your user is not physically online\nbrowsing your website.\n\nTo request offline access for a web app type, make sure you set the\n`access_type` parameter to `offline`. You can find additional information in\n[Google's OAuth2 guide](/identity/protocols/oauth2/web-server#offline).\n\nFor the desktop app type, offline access is enabled by default---you\ndon't have to explicitly request it.\n\nRequest headers\n---------------\n\n### gRPC headers\n\nWhen using the gRPC API, include the access token in each request. You can bind\na `Credential` to a `Channel` for use on all requests on that channel. You can\nalso send a customized credential for each call. The [gRPC\nAuthorization guide](//grpc.io/docs/guides/auth.html) contains more\ndetails on handling authorization.\n\n### REST headers\n\nWhen using the REST API, pass the access token through the HTTP header\n`Authorization`. An example HTTP request is shown below: \n\n```http\nGET /v21/customers/\u003cvar translate=\"no\"\u003e123456789\u003c/var\u003e HTTP/2\nHost: googleads.googleapis.com\nUser-Agent: INSERT_USER_AGENT\nAccept: */*\nAuthorization: Bearer \u003cvar translate=\"no\"\u003eINSERT_ACCESS_TOKEN\u003c/var\u003e\ndeveloper-token: INSERT_DEVELOPER_TOKEN\n```\n\nAccess and refresh token\n------------------------\n\nIn most cases, you need to store the refresh token securely for future use.\nTo learn more about how to request access and refresh tokens, read the\ncorresponding guide for your application type:\n\n- [Desktop app](/identity/protocols/oauth2/native-app)\n- [Server-side web app](/identity/protocols/oauth2/web-server)\n\nRefresh token expiration\n------------------------\n\nFor more details about the refresh token expiration, refer to the [Google\nIdentity Platform OAuth documentation](/identity/protocols/oauth2#expiration).\n\nAccess token expiration\n-----------------------\n\nAn access token has an expiration time (based on the\n[`expires_in`](//tools.ietf.org/html/rfc6749#appendix-A.14) value) after\nwhich the token is no longer valid. You can use the refresh token to refresh\nan expired access token. By default, our client libraries automatically\nrefresh expired access tokens."]]