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
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:
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.
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:
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.
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.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.