gdrive icon indicating copy to clipboard operation
gdrive copied to clipboard

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

Open hansgv opened this issue 2 years ago • 14 comments

I received an email from Google saying I "have OAuth clients that used the OAuth OOB flow in the past."

Is this something that has been or can be fixed in gdrive?

hansgv avatar Aug 26 '22 21:08 hansgv

See https://github.com/msfjarvis/gdrive or https://github.com/carstentrink/gdrive

carstentrink avatar Sep 06 '22 17:09 carstentrink

@carstentrink Thanks for the suggestion!

I managed to compile and install https://github.com/msfjarvis/gdrive. When I run gdrive it asks to re-authorize by visiting a Google URL (I suppose my old .gdrive/token_v2.json doesn't work with this fork). Visiting the URL I get:

Authorization Error Error 400: invalid_request Missing required parameter: client_id

hansgv avatar Sep 06 '22 18:09 hansgv

In msfjarvis/gdrive you need to place the json file with clientId and clientSecret from https://console.cloud.google.com/ in some place (I also do not know which location to place it). Either way it will NOT work as it is NOT in production.

self advertising

Just see the README in https://github.com/carstentrink/gdrive

  • You need to edit the clientId and clientSecret in the file handlers_drive.go.
  • Then compile.

carstentrink avatar Sep 28 '22 08:09 carstentrink

@carstentrink THANK YOU! 🙌🏻

For other dummies like myself, here's what I did:

  1. Followed these instructions to install the latest Go (min. 1.17 required) on Ubuntu 20.04
  2. Downloaded https://github.com/carstentrink/gdrive/archive/refs/heads/main.zip
  3. Edited handlers_drive.go to include my credentials, as instructed in README
  4. Executed go build in the gdrive-main directory
  5. Moved the generated gdrive binary to /usr/local/bin/
  6. Executed gdrive version for the first time to get a Verification URL and Authorization Code prompt
  7. Visited the verification URL. Accepted the fact that gdrive isn't a 'Google approved' app. Pasted the provided Authorization Code to the prompt

hansgv avatar Sep 28 '22 18:09 hansgv

@carstentrink

Please clarify. I was looking at https://developers.google.com/identity/protocols/oauth2/resources/oob-migration#inspect-your-application-code but the 'RedirectURL' line in auth/oauth.go is still type 'oob'. As far as I understood this type will stop working after 3 days, as commented https://developers.google.com/identity/protocols/oauth2/resources/oob-migration#desktop-client Thanks

olyair11 avatar Sep 30 '22 00:09 olyair11

Edit: Please change to production as described in README

carstentrink avatar Sep 30 '22 10:09 carstentrink

One small change to hansgv's comment. In step 6 I executed gdrive about for the Verification URL.

juliusspencer avatar Oct 10 '22 18:10 juliusspencer

Someone messed with @carstentrink code and we can't compile now.

# github.com/msfjarvis/gdrive
./handlers_drive.go:369:74: undefined: auth.AuthCodeHTTP

likid avatar Oct 12 '22 14:10 likid

Please try again with ./compile. I have fixed it. I am using go1.19.1 version.

(If you need linux device then try https://console.cloud.google.com/home/dashboard?cloudshell=true)

carstentrink avatar Oct 13 '22 19:10 carstentrink

Hi, I'm using a headless linux box but can't sign in to google with my user using browsh.

I tried compiling on MacOS without any errors, but got the following when trying to run the ./gdrive about command:

Failed to get about: Get "https://www.googleapis.com/drive/v3/about?alt=json&fields=maxImportSizes%2CmaxUploadSize%2CstorageQuota%2Cuser&prettyPrint=false": oauth2: cannot fetch token: 400 Bad Request
Response: {
  "error": "invalid_grant",
  "error_description": "Token has been expired or revoked."
}

Any ideas on how to sign in?

I would like to use this in a CI system, but I think the token will keep expiring…

juliusspencer avatar Oct 18 '22 07:10 juliusspencer

@juliusspencer

Authorise it locally then copy both linux binary and .config/gdrive/something.jsonto the remote box.

carstentrink avatar Oct 21 '22 09:10 carstentrink

Thanks, yeah I did just that, I just need to update the variable that stores the token as it updates as the docker container overwrites it. I'm almost there.

juliusspencer avatar Oct 21 '22 09:10 juliusspencer

May be this repo has some actions that are useful. https://github.com/marufshidiq/gdrive-cli-builder/blob/master/.github/workflows/build.yml

carstentrink avatar Oct 21 '22 09:10 carstentrink

This is great, and everything works, except ~/.config/gdrive/USERNAME_v2.json is not created. I created the folder structure ~/.config/gdrive/ and then the file USERNAME_v2.json was created correctly.

jfronza avatar Nov 30 '22 23:11 jfronza