skip to Main Content

I’ve sorted through many threads on this topic but most seem outdated.

I am trying to call the YouTube Reporting API with this script

However I keep getting an error:

  • When using ‘Desktop Application’ OAuth, I get:

Error 400: invalid_request, The out-of-band (OOB) flow has been blocked in order to keep users secure.

  • When using ‘Web Application’ OAuth, I get:

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.

I am just still testing my code and been running out of jupyter notebook and Visual Studio Code. Same errors on both.

I am still a little confused as to which one I should be using, but adding redirect URI’s for my localhost is not working, not sure how to proceed.

2

Answers


  1. The errors you mentioned indicate issues with the OAuth configuration for your YouTube Reporting API authentication. Let’s break down the errors and address them individually:

    Error 400: invalid_request - The out-of-band (OOB) flow has been blocked in order to keep users secure.
    

    This error occurs when you’re using the "Desktop Application" OAuth type and the out-of-band flow (OOB) is not allowed. To resolve this, you can switch to using the "Web Application" OAuth type.

    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.
    

    This error occurs when you’re using the "Web Application" OAuth type and specifying the redirect URI as "urn:ietf:wg:oauth:2.0:oob," which is only allowed for native applications, not web clients.

    To address this error, you should provide a valid redirect URI that matches the configuration of your OAuth client. Here are the steps to follow:

    Go to the Google Cloud Console (https://console.cloud.google.com/).
    Select your project (or create a new one if you haven't already).
    In the left sidebar, click on "Credentials" under the "APIs & Services" section.
    Find your OAuth 2.0 client ID for the project and click on it.
    In the "Authorized redirect URIs" section, add the redirect URI(s) that you want to use. For testing purposes, you can use http://localhost:<port>/oauth2callback as the redirect URI, replacing <port> with the appropriate port number (e.g., 8080).
    Save the changes.
    

    After setting up the redirect URI, update your authentication code to use the appropriate redirect URI. Make sure it matches the one you specified in the Google Cloud Console.

    Login or Signup to reply.
  2. When using ‘Desktop Application’ OAuth, I get:
    Error 400: invalid_request, The out-of-band (OOB) flow has been blocked in order to keep users secure.

    Open your credentials.json file is there a redirect uri that looks like this urn:ietf:wg:oauth:2.0:oob if so delete it.

    When using ‘Web Application’ OAuth, I get:
    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.

    urn:ietf:wg:oauth:2.0:oob is not a valid redirect uri for web or or installed apps anymore. Not that it ever was for web. You can only use http://localhost for installed apps now.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search