cloudfoundry / cloudfoundry/uaa-cli

politely suggest re-login if ~/.uaa/config.json is v0.0.1 format - upgrading from v0.0.1 to master/HEAD panics

Open
#20 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

unscheduled
Dominant language
Go
Stars
22
Forks
14
Avg merge
1d 11h
Merged PRs (30d)
11

Description

If I've already logged in with uaa v0.0.1, and then try to upgrade to master branch I am rewarded with an ugly panic. Perhaps instead, politely suggest to the user to re-authenticate/re-login if ~/.uaa/config.json exists, but the token is invalid, etc.

$ uaa version
0.0.1

$ VERSION=0.0.1 make build
$ build/uaa version
0.0.1 aa21f51
$ build/uaa clients

panic: must supply a valid token

goroutine 1 [running]:
code.cloudfoundry.org/uaa-cli/cmd.GetAPIFromSavedTokenInContext(0x1d)
	/Users/drnic/Projects/gopath/src/code.cloudfoundry.org/uaa-cli/cmd/api_client.go:20 +0x9fd
...

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read cmd/api_client.go at GetAPIFromSavedTokenInContext, then reproduce the failure with an existing ~/.uaa/config.json from uaa v0.0.1 and the clients command. Replace the panic for an invalid saved token with a polite re-authentication prompt, and verify that the command no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.