title: Authorization error when using YouTube Data API
body: <p>I'm trying to use the YouTube Data API v3, but when I run my script I get following error:</p>
  <p>This is the script I'm using:</p>
  <pre><code>import os
  
  import google_auth_oauthlib.flow
  import googleapiclient.discovery
  import googleapiclient.errors
  
  from googleapiclient.http import MediaFileUpload
  
  scopes = [&quot;https://www.googleapis.com/auth/youtube&quot;]
  
  def main():
      # Disable OAuthlib's HTTPS verification when running locally.
      # *DO NOT* leave this option enabled in production.
      os.environ[&quot;OAUTHLIB_INSECURE_TRANSPORT&quot;] = &quot;1&quot;
  
      api_service_name = &quot;youtube&quot;
      api_version = &quot;v3&quot;
      client_secrets_file = &quot;client_secret.json&quot;
  
      # Get credentials and create an API client
      flow = google_auth_oauthlib.flow.InstalledAppFlow.from_client_secrets_file(
          client_secrets_file, scopes)
      credentials = flow.run_console()
      youtube = googleapiclient.discovery.build(
          api_service_name, api_version, credentials=credentials)
  
      request = youtube.thumbnails().set(
          videoId=&quot;EoOUcFHsE9w&quot;,
          
          # TODO: For this request to work, you must replace &quot;YOUR_FILE&quot;
          #       with a pointer to the actual file you are uploading.
          media_body=MediaFileUpload(&quot;300coin.png&quot;)
      )
      response = request.execute()
  
      print(response)
  
  if __name__ == &quot;__main__&quot;:
      main()
  </code></pre>
  <p>When I run this script, I get this in my console:</p>
  <pre><code>Please visit this URL to authorize this application: https://accounts.google.com/o/oauth2/auth?response_type=code&amp;client_id=763961784735-ti8rm4futst2u81hdmnaf803e9gcfm82.apps.googleusercontent.com&amp;redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&amp;scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&amp;state=NQWjaXU1VCruBsePLHo0M8U6eDCsoF&amp;prompt=consent&amp;access_type=offline
  Enter the authorization code: 
  </code></pre>
  <p>When I follow the link, a browser opens with this notification:</p>
  <pre><code>Error 400: redirect_uri_mismatch
  The redirect URI in the request, urn:ietf:wg:oauth:2.0:oob, can only be used by a Client ID for native application. It is not allowed for the WEB client type. You can create a Client ID for native application at
  </code></pre>
  <p>In the ClientId for web applications I use for Authorized JavaScript origins: <code>http://localhost:8080</code>. For Authorized redirect URIs: <code>http://localhost:8080</code>.</p>
  <p>When I go to domain verification and I want to add localhost, I have to write <code>http://www.localhost:8080</code> to even get the google verification .html file
  but needless to say, the domain <code>http://www.localhost:8080</code> doesn't work.
  So how do I fix this issue?</p>
  <p>All I want is to run a script and update my thumbnails in Python.</p>