Obtaining authorization credentials

  • Applications using the YouTube Data API require authorization credentials for access.

  • The Google API Console supports two types of credentials: OAuth 2.0 tokens for private user data and API keys for general API access.

  • OAuth 2.0 credentials can be generated for web applications, service accounts, or installed applications.

  • API keys identify your project and provide API access, quota management, and usage reports, and can be restricted in scope.

  • You must create the credential, either the API key or OAuth 2.0, that will fit the needs of the project.

Your application must have authorization credentials to be able to use the YouTube Data API. This document describes the different types of authorization credentials that the Google API Console supports. It also explains how to find or create authorization credentials for your project.

Create your project and select API services

  1. Open the Credentials page in the API Console.
  2. This API supports two types of credentials. Create whichever credentials are appropriate for your project:
    • OAuth 2.0: Whenever your application requests private user data, it must send an OAuth 2.0 token along with the request. Your application first sends a client ID and, possibly, a client secret to obtain a token. You can generate OAuth 2.0 credentials for web applications, service accounts, or installed applications.

      For more information, see the OAuth 2.0 documentation.

    • API keys: A request that does not provide an OAuth 2.0 token must send an API key. The key identifies your project and provides API access, quota, and reports.

      The API supports several types of restrictions on API keys. If the API key that you need doesn't already exist, then create an API key in the Console by clicking Create credentials  > API key. You can restrict the key before using it in production by clicking Restrict key and selecting one of the Restrictions.

To keep your API keys secure, follow the best practices for securely using API keys.