8.11. Setting Up the YouTube API Key

This section describes how to set the YouTube API key for your instance of Open edX.

8.11.1. Overview

If you intend for courses on your Open edX instance to include videos that are hosted on YouTube, you must get a YouTube API key and set the key in the Open edX Platform.

The Open edX Platform uses the YouTube Data API v3, which requires that the application uses an API key.

8.11.2. Get a YouTube API key

To get the YouTube API key, follow YouTube’s instructions for obtaining authorization credentials.


Before proceeding, review Guidelines for Updating the edX Platform.

8.11.3. Install the YouTube API key in Open edX

After you obtain a YouTube API key, you must install that key into your Open edX installation. There are two different ways you can do this. Option 2: JSON files

Ansible outputs information to several JSON files used by Open edX. If you prefer not to edit the Ansible configuration, you can edit these files directly.

However, every time you update Open edX, your edits will be overwritten by Ansible. As a result, we recommend setting your YouTube API key in Ansible’s configuration instead.

To set your YouTube API key by editing JSON files, complete the following steps.

  1. Find the edx-platform repository on your Open edX server. If you are running Devstack or Fullstack, the directory is /edx/app/edxapp/edx- platform.

  2. In the directory above your repository, there should be several JSON files, including lms.auth.json and cms.auth.json. If you are running Devstack or Fullstack, the directory is /edx/app/edxapp.

  3. Open the lms.auth.json file in your text editor.

  4. Find the line for the YouTube API key. "YOUTUBE_API_KEY": "PUT_YOUR_API_KEY_HERE",

    Replace PUT_YOUR_API_KEY_HERE with your YouTube API key. Ensure that the YouTube API key is within by quotation marks.

  5. Save and close the file.

  6. Open the cms.auth.json file and make the same change. If that line does not exist in this file, create it.

  7. Save and close the file.