From 7bd76a1bb4a84ded67e62d03315340ac7fd7bb63 Mon Sep 17 00:00:00 2001 From: Andrey Kostakov Date: Sun, 8 Dec 2019 22:56:50 +0300 Subject: [PATCH] Show link to the auth page even if we couldn't open a browser. (#53) * Show link to the auth page even if we couldn't open a browser. In case if we couldn't open a browser using `xdg-open` (For example xdg-utils can be not installed in the system) -- user will still able to follow the link (copy-paste from the terminal) and obtain oauth code. Message will look like this: ``` Can't open browser (exec: "xdg-open": executable file not found in $PATH: ). Please follow the link: https://accounts.google.com/o/oauth2 ``` * Add line break. Co-Authored-By: Matt Holt --- .gitignore | 2 +- oauth2client/browser.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 227cd3d..ecb4b22 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ _gitignore/ _storage/ oauth2client/oauth2proxy/cmd/oauth2proxy/credentials.toml -cmd/timeliner/timeliner.toml +**/timeliner.toml cmc/timeliner/timeliner \ No newline at end of file diff --git a/oauth2client/browser.go b/oauth2client/browser.go index a8cec9e..e0cec2f 100644 --- a/oauth2client/browser.go +++ b/oauth2client/browser.go @@ -73,7 +73,7 @@ func (b Browser) Get(expectedStateVal, authCodeURL string) (string, error) { err = openBrowser(authCodeURL) if err != nil { - return "", err + fmt.Printf("Can't open browser: %s.\nPlease follow this link: %s", err, authCodeURL) } select {