davidstrauss / google-drive-recursive-ownership

Tool to recursively give away file and document ownership to another user.
MIT License
268 stars 68 forks source link

Error 400: Invalid request #42

Open sharonkatz510 opened 1 year ago

sharonkatz510 commented 1 year ago

Hey, first off thanks alot for your effort. When I try to run the terminal command it gives me a link for authorization. However when I press the link I get the following error message from google:

Error 400: invalid_request
The out-of-band (OOB) flow has been blocked in order to keep users secure. Follow the Out-of-Band (OOB) flow Migration Guide linked in the developer docs below to migrate your app to an alternative method.
Request details: redirect_uri=urn:ietf:wg:oauth:2.0:oob

Google's suggested solution seems simple:

image

however I'm not sure how it can be implemnted into your code.

Would really appreciate your help on this. Thanks.

dan-riley commented 1 year ago

Just ran into this as well after finally figuring out how to setup the client json. The above is just code to advise users that it's being shutdown. It appears the actual solution that has to be implemented is here: https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback but I don't think it's very straightforward.

dan-riley commented 1 year ago

Actually found a hacky solution. In transfer.py, change

flow.redirect_uri = oauth2client.client.OOB_CALLBACK_URN

to

flow.redirect_uri = "https://localhost"

In your browser when you paste the link provided when you run transfer.py, it will now allow you to login and authorize Recurse, but then give an error. But in the URL there will be a code= and that's the code needed! Not sure how long this will work but at least for now it does!

wildintellect commented 6 months ago

I got it to work with a change to the flow, but will only work on non-headless systems (you need a web browser on the same machine) https://github.com/wildintellect/google-drive-recursive-ownership/tree/fix/oob