認証情報を取得する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
YouTube Reporting API または YouTube Analytics API を使用するには、アプリケーションに認証情報が必要です。
このドキュメントでは、Google API Console でサポートされている認証情報の種類について説明します。プロジェクトの承認認証情報を検索または作成する方法も説明しています。
プロジェクトを作成して API サービスを選択する
- API コンソールで [認証情報] ページを開きます。
-
このページでは、2 種類の認証情報を作成できます。
ただし、YouTube Reporting API と YouTube Analytics API のすべてのメソッドには、OAuth 2.0 認証が必要です。
以下の手順に沿って、OAuth 2.0 認証情報を生成します。
-
OAuth 2.0: アプリケーションからユーザーの限定公開データをリクエストする場合は、リクエストとともに OAuth 2.0 トークンを送信する必要があります。アプリケーションは、トークンを取得するためにまずクライアント ID を送信します。場合によってはクライアント シークレットも送信します。ウェブ アプリケーション、サービス アカウント、インストールしたアプリケーションについて OAuth 2.0 認証情報を生成できます。
詳細については、OAuth 2.0 ドキュメントをご覧ください。
-
API キー:
必要に応じて、リクエストに API キーを含めることができます。
キーによりプロジェクトが識別され、API アクセス、割り当て、レポートが提供されます。
YouTube Reporting API と YouTube Analytics API のすべてのメソッドには、OAuth 2.0 認証が必要です。
そのため、上記の手順に沿って OAuth 2.0 認証情報を生成する必要があります。必要に応じて API キーを送信することもできますが、必須ではありません。
API は、いくつかのタイプの API キーをサポートします。必要とする API キーのタイプが存在しない場合は、[認証情報作成] > [API キー] をクリックして、コンソールで API キーを作成します。本番環境でそれを使用する前にキーを制限するには、[キーを制限] をクリックして、いずれかの制限を選択します。
API キーの安全性を保つには、API キーを安全に使用するためのおすすめの方法に従ってください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-08-21 UTC。
[null,null,["最終更新日 2025-08-21 UTC。"],[[["\u003cp\u003eApplications need authorization credentials to use the YouTube Reporting API or the YouTube Analytics API.\u003c/p\u003e\n"],["\u003cp\u003eThe Google API Console supports different types of credentials, but the YouTube Reporting API and YouTube Analytics API require OAuth 2.0 authorization.\u003c/p\u003e\n"],["\u003cp\u003eOAuth 2.0 credentials, which involve a client ID and potentially a client secret, are needed for applications requesting private user data.\u003c/p\u003e\n"],["\u003cp\u003eAPI keys can be used to identify a project and provide API access, but are not necessary for the YouTube Reporting API and the YouTube Analytics API.\u003c/p\u003e\n"],["\u003cp\u003eYou can generate OAuth 2.0 credentials for web applications, service accounts, or installed applications.\u003c/p\u003e\n"]]],["To use the YouTube Reporting or Analytics APIs, applications need authorization credentials. Navigate to the Credentials page in the Google API Console to create them. While API keys can be created and optionally used, OAuth 2.0 credentials are required for all methods in these APIs. Generate OAuth 2.0 credentials, including a client ID and secret. API keys identify your project and can be restricted for security, but are not a replacement for OAuth 2.0 tokens.\n"],null,["Your application must have authorization credentials to be able to use the YouTube Reporting API or the YouTube Analytics API.\n\nThis document describes the different types of authorization credentials that the [Google API Console](https://console.cloud.google.com/) supports. It also explains how to find or create authorization credentials for your project.\n\nCreate your project and select API services\n\n1. Open the [Credentials page](https://console.cloud.google.com/apis/credentials) in the API Console.\n2. The page allows you to create two different types of credentials. However, all of the methods for the YouTube Reporting API and the YouTube Analytics API require OAuth 2.0 authorization. Follow the instructions below to generate OAuth 2.0 credentials.\n - **OAuth 2.0:** Whenever your application requests private user\n data, it must send an OAuth 2.0 token along with the request. Your\n application first sends a client ID and, possibly, a client secret to\n obtain a token. You can generate OAuth 2.0 credentials for web\n applications, service accounts, or installed applications.\n\n For more information, see the [OAuth 2.0 documentation](https://developers.google.com/identity/protocols/OAuth2).\n - **API keys:**\n\n You have the option of including an API key with a request.\n\n The key identifies your project and provides API access, quota, and\n reports.\n\n\n Note that all of the methods for the YouTube Reporting API and the\n YouTube Analytics API require OAuth 2.0 authorization.\n\n\n For that reason, you need to follow the instructions above for\n generating OAuth 2.0 credentials. If you want, you can also send an\n API key, but that's not necessary.\n\n The API supports several types of restrictions on API keys. If the API key that you\n need doesn't already exist, then create an API key in the Console by\n clicking **[Create credentials](https://console.cloud.google.com/apis/credentials) \\\u003e API key** . You can restrict the key before using it\n in production by clicking **Restrict key** and selecting one of the\n **Restrictions**.\n\nTo keep your API keys secure, follow the [best practices for\nsecurely using API keys](//cloud.google.com/docs/authentication/api-keys)."]]