title: Why am I getting "Request is missing required authentication credential" when making POST request to YouTube API v3 with Python Requests module?
body: <p>I am downloading YouTube comments with Python by making POST requests with the Requests module to</p>
  <p><code>https://www.googleapis.com/youtube/v3/commentThreads</code>.</p>
  <p>However, even though I am supplying an API key, I am getting the following error message:</p>
  <p><code>{'error': {'code': 401, 'message': 'Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.', 'errors': [{'message': 'Login Required.', 'domain': 'global', 'reason': 'required', 'location': 'Authorization', 'locationType': 'header'}], 'status': 'UNAUTHENTICATED'}}</code>.</p>
  <p>From what I can gather, this (and the link) is saying that I need an OAuth 2 token, but I don't feel like that is applicable to the kind of function I am trying to carry out.</p>
  <p>Here is the code I am using to make the request:</p>
  <pre><code>import requests
  
  YOUTUBE_COMMENTS_URL = 'https://www.googleapis.com/youtube/v3/commentThreads'
  params = {
              'part': 'snippet,replies',
              'maxResults': 100,
              'videoId': video_id,
              'textFormat': 'plainText',
              'key': ******
          }
          
  headers = {
              'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
          }
  data = requests.post(self.YOUTUBE_COMMENTS_URL, params=params, headers=headers)
  results = data.json()
  </code></pre>
  <p>Can anyone tell me why I am getting this error message?</p>