argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.33k stars 5.26k forks source link

sso login via cli always failing (on my machine) #2018

Closed StefanMadsen closed 4 years ago

StefanMadsen commented 5 years ago

Describe the bug logging in via the command argocd login --grpc-web --sso gives a exit status 3

Looking through the source, its most likely related to the http module, and I'm guessing the local http (callback) server is failing

To Reproduce It fails all the time on my installation, but it works on colleagues machines, so its most likely something regarding my setup

If we cannot reproduce, we cannot fix! Steps to reproduce the behavior: argocd login --grpc-web --sso

Expected behavior expected to be logged in

Version

argocd: v1.0.2+e0bd546.dirty
  BuildDate: 2019-06-14T17:13:49Z
  GitCommit: e0bd546a07818ec06a27c2b3033454e3eb1c4152
  GitTreeState: dirty
  GoVersion: go1.11.4
  Compiler: gc
  Platform: linux/amd64

Logs

$ argocd login --grpc-web --sso <server> --loglevel debug
DEBU[0000] OIDC Configuration:
DEBU[0000]   supported_scopes: [openid email groups profile offline_access]
DEBU[0000]   response_types_supported: [code]
Opening browser for authentication
Performing authorization_code flow login: https://<server>/api/dex/auth?access_type=offline&client_id=argo-cd-cli&redirect_uri=http%3A%2F%2Flocalhost%3A8085%2Fauth%2Fcallback&response_type=code&scope=openid+profile+email+groups+offline_access&state=UDOqbEtpFu
FATA[0002] exit status 3
$

Have you thought about contributing a fix yourself? Sure

Notes Running linux subsystem for windows

NAME="Ubuntu"
VERSION="18.04.2 LTS (Bionic Beaver)"
..

works fine on my colleagues linux subsystem for windows - though running ubuntu 16.04.2

alexec commented 5 years ago

@alexmt ?

StefanMadsen commented 4 years ago

any news here?

StefanMadsen commented 4 years ago

still bugged in updated version: argocd: v1.0.2+e0bd546.dirty BuildDate: 2019-06-14T17:13:49Z GitCommit: e0bd546a07818ec06a27c2b3033454e3eb1c4152 GitTreeState: dirty GoVersion: go1.11.4 Compiler: gc Platform: linux/amd64

llamerada-jp commented 4 years ago

@StefanMadsen , @alexmt Did you install a web browser on your machine? We experimented similar situation. And It solved by installing a web browser (ex: chromium-browser). We guessed ArgoCD login command(with --sso option) is using a web browser by xdg-open and if xdg was failed, it occurs the error.

Env:

$ argocd version
argocd: v1.2.2+1aaf76f
  BuildDate: 2019-09-24T19:19:32Z
  GitCommit: 1aaf76f2303507479a9087e35be2b813eef316f2
  GitTreeState: clean
  GoVersion: go1.12.6
  Compiler: gc
  Platform: linux/amd64

Log:

$ argocd login <your url> --sso
Opening browser for authentication
Performing authorization_code flow login: https://<your url>/api/dex/auth?access_type=offline&client_id=argo-cd-cli&redirect_uri=http://localhost:8085/auth/callback&response_type=code&scope=openid profile email groups offline_access&state=ukrdlvAPoA
FATA[0009] exit status 3

Append: before we install a web browser, xdg command was failed like below.

$ xdg-open https://www.google.co.jp
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: x-www-browser: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: firefox: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: iceweasel: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: seamonkey: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: mozilla: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: epiphany: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: konqueror: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: chromium: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: chromium-browser: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: google-chrome: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: www-browser: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: links2: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: elinks: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: links: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: lynx: not found
/usr/bin/xdg-open: 851: /usr/bin/xdg-open: w3m: not found
xdg-open: no method available for opening 'https://www.google.co.jp'
StefanMadsen commented 4 years ago

excellent point, xdg-open does indeed report "not found" in WSL which lead me to look at making an alias for xdg-open to overwrite the behaviour. but i found a nice script that works a charm: https://github.com/4U6U57/wsl-open

this forwards the xdg-open call to the windows host system

castleadmin commented 3 years ago

On new Ubuntu WSL instances wslview is pre-installed. You can create a pseudo xdg-open like this sudo ln -s $(which wslview) /usr/local/bin/xdg-open See also https://github.com/cli/cli/issues/826

neoromantique commented 9 months ago

excellent point, xdg-open does indeed report "not found" in WSL which lead me to look at making an alias for xdg-open to overwrite the behaviour. but i found a nice script that works a charm: https://github.com/4U6U57/wsl-open

this forwards the xdg-open call to the windows host system

I'm sorry, but that is not a solution, lack of xdg-open should not be a critical error