upbound / up

The @upbound CLI
Apache License 2.0
52 stars 41 forks source link

Token based login asks for a username #207

Closed plumbis closed 2 years ago

plumbis commented 2 years ago

What happened?

Token based login worked properly in v0.11.0

In v0.12 (and v0.13.0-rc.0) passing -t <token> the CLI asks for a username.

How can we reproduce it?

v0.11 (working)

  1. Delete local UP cache.
    vagrant@kubecontroller-01:~$ rm -rf .up
  2. Confirm binary version
    vagrant@kubecontroller-01:~$ ./up-11.0 --version
    v0.11.0
  3. Confirm the user is not logged in
    
    vagrant@kubecontroller-01:~$ ./up-11.0 ctp list
    Usage: up controlplane list

List control planes for the account.

Flags: -h, --help Show context-sensitive help. -v, --version Print version and exit.

  --endpoint=https://api.upbound.io    Endpoint used for Upbound API ($UP_ENDPOINT).
  --profile=STRING                     Profile used to execute command ($UP_PROFILE).

-a, --account=STRING Account used to execute command ($UP_ACCOUNT).

up: error: no default profile specified

4.  Login

vagrant@kubecontroller-01:~$ ./up-11.0 login -t $UP_TOKEN -a upbound-docs

5. Confirm the user is logged in

vagrant@kubecontroller-01:~$ ./up-11.0 ctp list


**v0.12.0** (broken)
1. Delete local UP cache. 

vagrant@kubecontroller-01:~$ rm -rf .up

2. Confirm binary version

vagrant@kubecontroller-01:~$ ./up-12.0 --version v0.12.0

3. Confirm the user is not logged in ( _Note: error message has changed_)

vagrant@kubecontroller-01:~$ ./up-12.0 ctp list up: error: permission denied: {"message":"Unauthorized"}

4.  Login

vagrant@kubecontroller-01:~$ ./up-12.0 login -t $UP_TOKEN -a upbound-docs Username: ^C vagrant@kubecontroller-01:~$



### What environment did it happen in?
**Working** v0.11.0
**Broken** v0.12.0, v0.13.0-rc.0
hasheddan commented 2 years ago

Broken by https://github.com/upbound/up/commit/7865e2d14cc05832d2cd9fda1964055ca0fb05a0#diff-4b617c7f9a2a1e37118450e458076860eb7876491f318286d21e2c7720838f17L76