# YOUTUBE\_API\_KEY in Open edX

**URL:** <https://discuss.openedx.org/t/youtube-api-key-in-open-edx/4175>\
**Category:** Site Operators\
**Created:** [February 1, 2021, 5:11pm UTC](https://discuss.openedx.org/t/youtube-api-key-in-open-edx/4175 "2021-02-01T17:11:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![guangyaw](https://avatars.discourse-cdn.com/v4/letter/g/b38774/32.png) [@guangyaw](https://discuss.openedx.org/u/guangyaw)\
**Post date:** [February 1, 2021, 5:11pm UTC](https://discuss.openedx.org/t/youtube-api-key-in-open-edx/4175/1 "2021-02-01T17:11:47Z")

</div>

‘YOUTUBE\_API\_KEY’ in /edx/etc/lms.yml .

1. I would like to know which function would need the key ? What the YOUTUBE\_API\_KEY work for?
2. If I didn’t put the correct YOUTUBE\_API\_KEY into lms.yml , what will be the impact?

---

<div class="post-metadata">

**Author:** ![ARMBouhali](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/armbouhali/32/324_2.png) [@ARMBouhali](https://discuss.openedx.org/u/ARMBouhali)\
**Post date:** [February 1, 2021, 7:37pm UTC](https://discuss.openedx.org/t/youtube-api-key-in-open-edx/4175/2 "2021-02-01T19:37:20Z")

</div>

According to the [documentation](https://edx.readthedocs.io/projects/edx-installing-configuring-and-running/en/latest/configuration/youtube_api.html)

> 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 youtube API key is required by the Video XBlock to work at its full potential.  
You’ll still be able to imbed videos without any issues. But some metadata won’t be able to load in both LMS and studio.

Youtube Data API is used by the video block to retrieve:

- video metadata: not sure what is used by the block (maybe descriptions, language, available quality, etc).
- video subtitles (timed text) : I found this as an example of subtitles in common.py files. but I am not sure if the video block is actually using youtube’s subtitles.  
[http://video.google.com/timedtext?lang=en&v=j\_jEn79vS3g](http://video.google.com/timedtext?lang=en&v=j_jEn79vS3g)

Any further contribution to my answer is more than welcome.  
Let us learn more, Open edX and edX folks !! 😄

---

<div class="post-metadata">

**Author:** ![eugenechabanov](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/eugenechabanov/32/3018_2.png) [@eugenechabanov](https://discuss.openedx.org/u/eugenechabanov)\
**Post date:** [June 17, 2021, 11:52am UTC](https://discuss.openedx.org/t/youtube-api-key-in-open-edx/4175/3 "2021-06-17T11:52:21Z")

</div>

Koa Native. I’ve set up an API and in lms.yml and lms/envs/common.py, switched off the transcripts for videos, restarted the system, but still get the same 3 errors in Firefox:

1. Blocked loading mixed active content “http://\<site\_url\>/yt\_video\_metadata?id=3\_yD\_cEKoCk
2. XHR GET https://\<site\_url\>/courses/course-v1:history+vd01+2020\_12/xblock/block-v1:history+vd01+2020\_12+type@video+block@7dc54247412e4eca8d0e9f4f9fe13b01/handler/transcript/translation/en?videoId=3\_yD\_cEKoCk  
[HTTP/1.1 404 Not Found 649ms]
3. Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘[https://www.youtube.com](https://www.youtube.com)’) does not match the recipient window’s origin (‘https://\<site\_url\>’)
