사용자 또는 애플리케이션이 App Engine Admin API를 사용하려면 먼저Google Cloud 프로젝트 소유자가 프로젝트에서 API를 사용 설정한 다음 사용자 또는 애플리케이션이 HTTP를 승인하는 데 사용할 수 있는 사용자 인증 정보를 만들어야 합니다.
예를 들어 소유자는 먼저 초기 Google Cloud프로젝트를 만든 다음 해당 프로젝트에서 사용자 인증 정보를 만들어야 누구든 Admin API에 HTTP 요청을 보낼 수 있습니다. 소유자가 초기 프로젝트를 설정하고 구성한 후 해당 프로젝트를 관리 목적으로 사용하여 다른 리소스를 프로그래매틱 방식으로 만들고 관리할 수 있습니다. 예를 들면 다음과 같습니다.
다른 Google Cloud 프로젝트 만들기
새로 만든 모든 프로젝트의 App Engine 애플리케이션 만들기
새로 만든 App Engine 애플리케이션에 앱 버전 배포
배포한 모든 버전의 리소스 관리
시작하기 전에
다음 작업을 완료하려면 사용자 및 애플리케이션이 액세스할 수 있도록 Admin API를 사용 설정하려는Google Cloud 프로젝트의 소유자여야 합니다.
프로젝트 구성 및 사용자 인증 정보 만들기
Google Cloud 프로젝트를 구성하고 사용자 인증 정보를 만들려면 다음 안내를 따르세요.
Google Cloud 프로젝트에서 App Engine Admin API와 Cloud Storage API를 모두 사용 설정합니다.
아래 예에서는 인증 흐름을 보여주기 위해 클라이언트 측 OAuth 2.0 흐름을 사용하여 토큰을 얻습니다. 이 토큰은 cURL 명령줄 도구를 사용하여 예시 앱을 [MY_PROJECT_ID] 프로젝트의 App Engine 애플리케이션에 배포하기 위해 Admin API로 수신되는 요청을 승인하는 데 사용됩니다.
인증 예
이 예에서 Implicit Grant Flow(암시적 권한 부여 과정)라고 하는 클라이언트 측 승인 과정을 진행하려면 사용자가 클라이언트 애플리케이션에 사용자 대신 Admin API에 액세스할 수 있는 권한을 승인해야 합니다. 반환되는 액세스 토큰은 일반적으로 해당 사용자가 애플리케이션에서 활성 상태인 동안 또는 약 60분 동안 유효합니다.
HTTP 요청
다음 URL은 Google Cloud 콘솔에서 생성된 클라이언트 ID를 사용하여 액세스 토큰을 요청한 후 앱에서 토큰을 받는 승인된 URI로 사용자를 리디렉션합니다.
[MY_CLIENT_ID]: Google Cloud 콘솔의 사용자 인증 정보 중 하나의 클라이언트 ID입니다.
[MY_REDIRECT_URI]: Google Cloud 콘솔의 동일한 사용자 인증 정보에 해당하는 승인된 리디렉션 URI입니다.
리디렉션 URI를 지정하지 않으면 신뢰할 수 있는 URI를 지정해야 합니다(예: https://www.google.com). 리디렉션 URI는 HTTP 응답이 전송되는 위치를 정의합니다. 프로덕션에서는 OAuth 2.0 서버의 응답을 처리하는 애플리케이션 인증 엔드포인트를 지정해야 합니다. 자세한 내용은 웹 서버 애플리케이션용 OAuth 2.0 사용을 참조하세요.
HTTP 응답
애플리케이션이 URL을 사용하여 승인을 요청하면 응답으로 액세스 토큰이 반환됩니다. 예를 들면 다음과 같습니다.
액세스 토큰을 얻은 후에는 이를 사용하여 Admin API에 액세스할 수 있습니다. 예를 들어 애플리케이션의 인증 엔드포인트는 응답에서 프로그래매틱 방식으로 액세스 토큰을 추출할 수 있습니다. cURL 명령어에서 수동으로 토큰을 사용하는 방법은 다음 예를 참조하세요.
cURL을 사용한 HTTP 요청 예
다음 cURL 명령어는 [MY_ACCESS_TOKEN] 액세스 토큰을 사용하여 HTTP POST 요청을 수행하는 방법을 보여줍니다. 이 cURL 명령어는 app.json 구성 파일에 정의된 리소스를 MY_PROJECT_ID 프로젝트의 애플리케이션에서 default 서비스에 있는 v1 버전에 배포합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[[["\u003cp\u003eProject owners must enable the App Engine Admin API and Cloud Storage API in their Google Cloud project before users or applications can access it.\u003c/p\u003e\n"],["\u003cp\u003eCredentials must be created within the project to authorize HTTP requests to the Admin API, using OAuth 2.0 scopes like \u003ccode\u003ehttps://www.googleapis.com/auth/appengine.admin\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/cloud-platform\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe initial project setup allows for administrative tasks like creating new Google Cloud projects, deploying app versions, and managing resources within those versions.\u003c/p\u003e\n"],["\u003cp\u003eAn access token, obtained through an OAuth 2.0 flow, is required to make authorized requests to the Admin API, as demonstrated in the provided cURL example for deploying resources.\u003c/p\u003e\n"],["\u003cp\u003eThe implicit grant flow can be utilized to obtain a temporary access token, valid for approximately 60 minutes, enabling client-side applications to access the Admin API on the user's behalf.\u003c/p\u003e\n"]]],[],null,["# Accessing the Admin API\n\nBefore users or applications can use the App Engine Admin API, you as a\nGoogle Cloud project owner must first enable the API in your project and\nthen create credentials that users or applications can use to authorize HTTP\nrequests.\n\nFor example, an owner must first create an initial Google Cloud\nproject and then create credentials in that project before anyone can send HTTP\nrequests to the Admin API. After the owner sets up and configures\nthe initial project, that project can then be used for administrative purposes\nto programmatically create and manage other resources, for example:\n\n- Creating other Google Cloud projects.\n- Creating App Engine applications for all newly created projects.\n- Deploying app versions to newly created App Engine applications.\n- Managing resources in all of the versions that you deployed.\n\nBefore you begin\n----------------\n\nTo complete the following task, you must be an owner of the\nGoogle Cloud project where you want to enable the\nAdmin API for users and applications to access.\n| **Tip:** You can use both the OAuth 2.0 Playground and APIs Explorer to [try out the\n| Admin API](/appengine/docs/admin-api/trying-the-api) before you start configuring your project.\n\nConfiguring your project and creating credentials\n-------------------------------------------------\n\nTo configure your Google Cloud project and create credentials:\n\n1. Enable both the App Engine Admin API and Cloud Storage API in your\n Google Cloud project:\n\n [Enable both APIs](https://console.cloud.google.com/flows/enableapi?apiid=appengine,storage_component)\n2. Create credentials that users and applications use to access the\n Admin API in your project.\n\n To create credentials, review the [Google Cloud Platform Auth\n Guide](/docs/authentication) and then choose the OAuth\n 2.0 authorization flow that meets your app's requirements.\n | **Important:** This API requires that you request access to one of the following OAuth 2.0 scopes in your code:\n | - `https://www.googleapis.com/auth/appengine.admin`\n | - `https://www.googleapis.com/auth/cloud-platform`\n | - `https://www.googleapis.com/auth/cloud-platform.read-only`\n |\n | The **Authorization** section on each method's reference page describes which OAuth scopes are required. Also see the list of methods, permissions, and related roles in [Controlling\n | Access](/appengine/docs/admin-api/access-control#permissions_and_roles) to help you determine which OAuth scope is adequate for your needs.\n\nExamples\n--------\n\nTo demonstrate an authentication flow, the examples below use the client-side\nOAuth 2.0 flow to obtain a token. The token is used to authorize requests to the\nAdmin API using the cURL command-line tool to deploy the example\napp to the App Engine application of the project `[MY_PROJECT_ID]`.\n\n### Authentication example\n\nIn this example, the client-side authorization flow known as the *implicit grant\nflow*, requires the user to authorize the client application for access to the\nAdmin API on behalf of the user. The access token that is returned is\nvalid for approximately 60 minutes or generally while the user is active on your\napplication.\n| **Tip:** For more information about the implicit grant flow and how the URL below is formed, see [using OAuth 2.0 for client-side web\n| applications](https://developers.google.com/identity/protocols/OAuth2UserAgent#formingtheurl).\n\n#### HTTP request\n\nThe following URL uses a client ID that was created in the Google Cloud console to\nrequest an access token and then redirect the user to an authorized URI where\nyour app receives the token: \n\n https://accounts.google.com/o/oauth2/v2/auth?\n response_type=token&\n client_id=[MY_CLIENT_ID].apps.googleusercontent.com&\n scope=https://www.googleapis.com/auth/cloud-platform&\n redirect_uri=[MY_REDIRECT_URI]\n\nWhere:\n\n- `[MY_CLIENT_ID]` is a **Client ID** from one of your credentials in the [Google Cloud console](https://console.cloud.google.com/apis/credentials).\n- `[MY_REDIRECT_URI]` is the corresponding **Authorized redirect URIs** from the same credential in the [Google Cloud console](https://console.cloud.google.com/apis/credentials). If no redirect URI is specified, you must specify a trusted URI, for example `https://www.google.com`. The redirect URI defines where the HTTP response is sent. For production, you must specify your application's auth endpoint, which handles responses from the OAuth 2.0 server. For more information, see [Using\n OAuth 2.0 for Web Server Applications](https://developers.google.com/identity/protocols/OAuth2WebServer#creatingcred).\n\n#### HTTP response\n\nWhen the application uses the URL to request authorization, the access token\nis returned in a response, for example: \n\n https://www.google.com/#access_token=[MY_ACCESS_TOKEN]&\n token_type=Bearer&\n expires_in=3600\n\nWhere `[MY_ACCESS_TOKEN]` is the returned access token that you requested.\n\nAfter you obtain an access token, you can use it to access the\nAdmin API. For example, your application's auth endpoint can\nprogrammatically extract the access token from the response. See the following\nexample for how to manually use your token in a cURL command.\n\n### HTTP request example using cURL\n\nThe following cURL command demonstrates how you can use your `[MY_ACCESS_TOKEN]`\naccess token to make an HTTP `POST` request. This cURL command deploys\nthe resources defined in the `app.json` configuration file to the `v1` version\nof the `default` service in the application of project `MY_PROJECT_ID`. \n\n curl -X POST -T \"app.json\" -H \"Content-Type: application/json\" -H \"Authorization: Bearer [MY_ACCESS_TOKEN]\" https://appengine.googleapis.com/v1/apps/[MY_PROJECT_ID]/services/default/versions\n\nWhat's next\n-----------\n\n- [Deploying Versions To Your\n Application](/appengine/docs/admin-api/deploying-overview)"]]