duplicacy icon indicating copy to clipboard operation
duplicacy copied to clipboard

google drive use direct link to google oauth page for generating access token

Open jorgeelmundoso opened this issue 4 years ago • 2 comments

There is a oauth schema for installed apps, nicely implemented in https://github.com/gdrive-org/gdrive/blob/c3cbcceedd6beb1fcff30f06ea7be7c29558d181/handlers_drive.go#L393-L406

It's only a few lines of code, but it will allow to print a url:

Authentication needed
Go to the following url in your browser:
https://accounts.google.com/o/oauth2/auth?access_type=offline&client_id=367116221053-7n0vf5akeru7on6o2fjinrecpdoe99eg.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=state

and scan the token from stdin without having to download the file, and without visiting a third party website like:

https://duplicacy.com/gcd_start

Same approach could be pushed to the web gui, just have an input text field to paste the token back in.

Of course you would need to come up with a place to store the token, could be pushed into the config.

This would improve usability and remove the need to trust https://duplicacy.com/gcd_start to not nick a token.

jorgeelmundoso avatar Jul 17 '20 20:07 jorgeelmundoso

This sounds really good and it would remove the hassle with gcd-token files if the token is stored by duplicacy. And for the Web edition it could be encrypted with the rest of the config.

sasjafor avatar Jan 11 '21 21:01 sasjafor

I second this.

Some points that imho are relevant:

  • Trusting duplicacy's centralized token thing is an absurd idea and I think the project shouldn't even offer that possibility
  • Setting up a service account only works for Workspace accounts, and requires to be a Workspace administrator
  • A service account is like killing a fly with a cannonball, i.e. you did it, and now have a very large and powerful object flying around as a side effect

I'm happy to submit a PR about this and plan to do so, I hope I'll find the time to work on it in the coming days/weeks.

UPDATE: apologies, but after wasting ~5 hours trying and failing to build the project due to the use of the old Go build system and unversioned dependencies, I decided to abandon the endeavour. If anyone wishes to take time to help me with the build, I'm happy to resume work.

vmsh0 avatar Oct 03 '22 09:10 vmsh0