tokland / youtube-upload

Upload videos to Youtube from the command line
2.08k stars 465 forks source link

Migrate your OAuth out-of-band flow to an alternative method before Oct. 3, 2022 #352

Open feacluster opened 2 years ago

feacluster commented 2 years ago

Got the very confusing email from Google a few months ago but have been dragging my feet on following it. So I tried today to create a new credentials as type "Desktop" in the same project. But when I try and upload the YouTube video, I get this:

It does not make sense as my .client_secrets.json file does not have any oob in it ( although the old one did ).

Capture

feacluster commented 2 years ago

So I've tried putting my own flow.redirect_uri in init.py as followed:

#    flow.redirect_uri =  "https://mysite.com"

But when I try and upload a video , google give me this error:

Authorization Error
Error 400: redirect_uri_mismatch

I also tried editing the .client_secret.json file with the same redirect_uri, but same error. The default is http://localhost or something..

Ready to pull my hair out ! I don't understand why google makes this so complicated. What does OOB even mean?? I know out of band , but what does it really mean? Doubt even the engineers at google know...

feacluster commented 2 years ago

Think I finally figured it out ( although not 100% sure this is kosher with Google ):

When creating your OAuth credential, I selected "Web application" and put in "https://mysite.com" for the authorized redirect_uri . Next I went to init.py and put in the same site for "flow.redirect_uri". Last, I deleted the .youtube-upload-credentials.json and tried to upload a new video. It then asked me to put the link in the browser. After doing so, it took me back to https://mysite.com, however, in the URL I could see the code. I copied this code and pasted it back into youtube-upload script and it worked..

Maybe this method is still deprecated/unsupported. Hopefully others can try and report back!

carlosnewmusic commented 1 year ago

I get this error with the correct google credentials. https://pastebin.com/myAsGApL

moneyforsomething commented 1 year ago

@feacluster - Did you manage to resolve this issue?

AkitaAttribute commented 1 year ago

@feacluster this worked for me, however to save everyone a step, you can leave your app as "Desktop App" and just change the line of code flow.redirect_uri = oauth2client.client.OOB_CALLBACK_URN to flow.redirect_uri = "http://localhost:8080". It'll take you to a broken page, but the code for your consent screen is in the URL. It may be encoded if it contains characters that need to be escaped, so you should paste it into something like http://www.asiteaboutnothing.net/c_decode-url.html this if you don't want to spend the effort re-learning the escape characters like I did.