Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI OAuth workflow never finishes with custom URI in redirect_url #13587

Open
soumith opened this issue Jul 19, 2022 · 16 comments
Open

CLI OAuth workflow never finishes with custom URI in redirect_url #13587

soumith opened this issue Jul 19, 2022 · 16 comments
Assignees
Labels
bug cli Command Line Interface dropbox Dropbox Protocol Implementation googledrive Google Drive Protocol Implementation googlestorage Google Cloud Storage Protocol Implementation onedrive OneDrive Protocol Implementation sharepoint
Milestone

Comments

@soumith
Copy link

soumith commented Jul 19, 2022

Describe the bug

In the duck CLI, take a simple workflow such as duck -l googledrive:/.
The CLI opens a browser, which does the OAuth workflow.
Once authenticated, the expectation is that you either have the OAuth redirect the CLI or some code shows on browser that you can paste back into CLI.
However, the OAuth redirect_url is set to open the CyberDuck app, and does not respect that the duck CLI originated the OAuth workflow.

To Reproduce
Steps to reproduce the behavior:

  1. Go to command-line
  2. Run duck -l googledrive:/
  3. Try to finish authentication workflow

Expected behavior
You expect the workflow to finish.
Either the OAuth takes you back to CLI and CLI finishes auth, or you get instructions on how to manually finish the workflow.

Desktop (please complete the following information):

  • macOS 12.4
  • [Also checked] Linux Ubuntu 20.04

Logs with --debug :
foo.log

@AliveDevil AliveDevil added bug cli Command Line Interface labels Jul 19, 2022
@dkocher dkocher added this to the 8.4.3 milestone Jul 19, 2022
@dkocher
Copy link
Contributor

dkocher commented Jul 19, 2022

This was missed in #13366.

@dkocher
Copy link
Contributor

dkocher commented Aug 15, 2022

Not sure how we should implement this, as manual copy & paste of authentication code 1 is deprecated .

Footnotes

  1. Important: The manual copy/paste option, also referred to as an out of band (OOB) redirect method, is DEPRECATED and will be removed in October 2022. Review the OOB migration guide for instructions on how to migrate to a secure alternative. https://developers.google.com/identity/protocols/oauth2/native-app#manual-copypaste

@soumith
Copy link
Author

soumith commented Aug 17, 2022

from the migration guide, the most matching option seems to be a loopback IP address -- so cyberduck temporarily listens on some localhost+port and that is given as the redirect_uri

https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback

@dkocher
Copy link
Contributor

dkocher commented Aug 17, 2022

Relates to #13476.

@dkocher
Copy link
Contributor

dkocher commented Aug 17, 2022

from the migration guide, the most matching option seems to be a loopback IP address -- so cyberduck temporarily listens on some localhost+port and that is given as the redirect_uri

https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri_loopback

We don't currently have an implementation using a listener on the loopback address as it is prone to man in the middle attacks. it is still feasible for desktop apps according to the documentation 1

…but will continue to be supported on desktop apps.

Footnotes

  1. https://developers.google.com/identity/protocols/oauth2/resources/loopback-migration

@dkocher dkocher modified the milestones: 8.4.3, 8.4.4 Aug 18, 2022
@dkocher dkocher modified the milestones: 8.4.4, 8.4.5 Sep 15, 2022
@dkocher dkocher modified the milestones: 8.4.5, 9.0 Oct 11, 2022
@dkocher dkocher added googledrive Google Drive Protocol Implementation googlestorage Google Cloud Storage Protocol Implementation dropbox Dropbox Protocol Implementation labels Feb 5, 2023
@dkocher dkocher changed the title CLI OAuth workflow never finishes as redirect_url is set wrong CLI OAuth workflow never finishes with custom URI in redirect_url Feb 27, 2023
@dkocher
Copy link
Contributor

dkocher commented Apr 6, 2023

You should be able to work with Cyberduck CLI by connecting first with Cyberduck and then use duck --username <email> -l googledrive:/.

@Ripper346
Copy link

Can it be done from another machine with cyberduck gui? If we installed duck in a unix system we can go for a walk with that workaround, it is useless in that case

@pedrohgmacedo
Copy link

The problem occurs with onedrive as well.

@stuckj
Copy link

stuckj commented Sep 15, 2023

Also occurs with Dropbox (as mentioned in #14282). Seems like you can't really use the CLI on Linux for any service with an oauth flow since there is no GUI for Linux.

@dkocher
Copy link
Contributor

dkocher commented Nov 22, 2023

Find attached 1 a connection profile for Dropbox that can be used with Cyberduck CLI using

duck --profile ~/Downloads/Dropbox\ \(CLI\).cyberduckprofile --list dropbox:/

Footnotes

  1. Dropbox (CLI).cyberduckprofile.zip

@stuckj
Copy link

stuckj commented Nov 22, 2023

@dkocher, I appreciate your message, but I'm not sure how that is helpful. The oauth client secret is blank in there (and kinda has to be since any secret you gave me would be to your account! :) ). And, you can't complete the oauth flow to get the secret.

I guess if you use a GUI on a windows machine with cyberduck (non-CLI) installed and connect on there you can find the profile on the machine and copy the key from there. At that point, you can just take that whole profile though, right? Where could we find that on a windows machine? Maybe I can just grab it from my windows installation (I dual boot with Linux and Windows).

@dkocher
Copy link
Contributor

dkocher commented Nov 22, 2023

@dkocher, I appreciate your message, but I'm not sure how that is helpful. The oauth client secret is blank in there…

The OAuth Authorization Code Flow implemented by Dropbox does not require a client secret and is therefore intentionally left blank in the profile.

@dkocher dkocher added the onedrive OneDrive Protocol Implementation label Jan 10, 2024
@dkocher
Copy link
Contributor

dkocher commented Jan 10, 2024

Find attached 1 a connection profile for Microsoft OneDrive that can be used with Cyberduck CLI using

duck --profile ~/Downloads/OneDrive\ \(CLI\).cyberduckprofile --list "onedrive:/My Files/"

Footnotes

  1. OneDrive (CLI).cyberduckprofile.zip

@dkocher
Copy link
Contributor

dkocher commented Jan 11, 2024

Make sure to use the --username parameter like

--username dkocher\@iterate.ch

to read saved tokens from the keychain or credentials manager.

@dkocher
Copy link
Contributor

dkocher commented Jan 28, 2024

Find attached 1 a connection profile for Microsoft SharePoint that can be used with Cyberduck CLI using

duck --profile ~/Downloads/Microsoft\ SharePoint\ \(CLI\).cyberduckprofile --list "sharepoint:/"

Footnotes

  1. Microsoft SharePoint (CLI).cyberduckprofile.zip

@mcx808
Copy link

mcx808 commented Jan 29, 2024

Find attached 1 a connection profile for Microsoft SharePoint that can be used with Cyberduck CLI using

duck --profile ~/Downloads/Microsoft\ SharePoint\ \(CLI\).cyberduckprofile --list "sharepoint:/"

Footnotes

  1. Microsoft SharePoint (CLI).cyberduckprofile.zip

@dkocher Is this an updated profile from the one posted previously?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli Command Line Interface dropbox Dropbox Protocol Implementation googledrive Google Drive Protocol Implementation googlestorage Google Cloud Storage Protocol Implementation onedrive OneDrive Protocol Implementation sharepoint
Projects
None yet
Development

No branches or pull requests

7 participants