-
Notifications
You must be signed in to change notification settings - Fork 0
Description
sandbox@a300baf63137:~$ glab auth login --hostname gitlab.com --git-protocol https
ERROR
Api-Host, api-protocol, and git-protocol can only be used in non-interactive mode..
sandbox@a300baf63137:~$ GLAB_USERNAME=$(glab api user --jq '.username')
ERROR
Unknown flag: --jq.
Try --help for usage.
sandbox@a300baf63137:~$ jq --version
bash: jq: command not found
The commands that we have in README.md example was not really tested, so they does not work at all.
sandbox@a300baf63137:~$ glab auth login
- Signing into gitlab.com
Failed opening a browser at https://gitlab.com/oauth/authorize?client_id=41d48f9422ebd655dd9cf2947d6979681dfaddc6d0c56f7628f6ada59559af1e&code_challenge=yowDbjljVfRzAKR76x3BC19h7rg3-Iw6g2wzEDbNjs8&code_challenge_method=S256&redirect_uri=http%3A%2F%2Flocalhost%3A7171%2Fauth%2Fredirect&response_type=code&scope=openid+profile+read_user+write_repository+api&state=Z6P80gXEtNccCw50QL7sFrtWlnZmZv_SlgHy7A3U-PQ
Encountered error: exec: "xdg-open": executable file not found in $PATH
Try entering the URL in your browser manually.
After that i redirects to something like:
http://localhost:7171/auth/redirect?code=02acc6c9d41a4559401c4bcac8fb214f7c91f3116bc72ce0d1bcfbdb5f8dfab3&state=Z6P80gXEtNccCw50QL7sFrtWlnZmZv_SlgHy7A3U-PQ
But even if I would use something like curl to make that pull request, I would first need to actually terminate the process of auth. Which is not convenient.
And at the end I was forces to do:
screen -R glab-auth
glab auth login # Inside screen
And
curl -L "http://localhost:7171/auth/redirect?code=a367a018d8371d8ce0da19c46cd1e8c4db129f8fe0342dd2a6c5ef8ad27c301d&state=FZ1JfF9qBbflundV_Pw37diPZ809RTwL3Px5wamIvL0"
Outside the screen in docker container.
sudo apt update
sudo apt install -y jq
sandbox@a300baf63137:~$ GLAB_USERNAME=$(glab api user --jq '.username')
ERROR
Unknown flag: --jq.
Try --help for usage.
sandbox@a300baf63137:~$ GLAB_USERNAME=$(glab api user | jq -r '.username')
sandbox@a300baf63137:~$ echo $GLAB_USERNAME
Konard
sandbox@a300baf63137:~$
We need to update README.md to include commands that actually work, and note about prerequisites, so if user decides not to install our tool, the commands in README.md main example are still helpful.
Also we should suggest user how to use a links got from auth process with curl -L (in docker or on server) or ssh tunnelling (on server).
As this tool should be the most useful in docker/server environments, not only directly on developer machine.
So our CLI tool should also use its terminal output to provide user with all nessesary instructions to actually complete the auth, so he does not waste time to go to any other place to consult.