Skip to content

new auth flow UX - #1548

Merged
vilmibm merged 17 commits into
trunkfrom
auth-check
Aug 25, 2020
Merged

vilmibm merged 17 commits into
trunkfrom
auth-check

Conversation

@vilmibm

@vilmibm vilmibm commented Aug 18, 2020 •

Copy link
Copy Markdown
Contributor

This PR:

  • removes the "browser auth flow on bad auth" code
  • greets user and asks them to use gh auth login if there is no auth config
  • improves error messaging around 401s, suggesting use of gh auth login
  • improves error messaging when none of a repo's remotes are known by gh

image

closes #1511

@vilmibm
vilmibm requested a review from mislav August 18, 2020 23:01
@tierninho
tierninho self-requested a review August 19, 2020 00:38

@tierninho tierninho left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran through the various scenarios, and all login methods were a success. All the new messaging was present as long as new cool graphic. ✅

  • I don't think we should fix anything, but just want to point out what a narrow terminal does to the graphic

    Screen Shot 2020-08-18 at 2 37 06 PM

  • Also, do we want to update GitHub Enterprise to GitHub Enterprise Server? More info desktop/desktop#7728

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the banner!

My main concern is about having all our bases covered and the fact that with this approach, we have to annotate all leaf commands, meaning that if we add another gh auth subcommand, we have to copy over the annotation. I've proposed a workaround.

Also, as noted in a comment, Cobra pseudo-commands such as help and __complete should never trigger authentication in my view, and also requesting help via -h (where available) and --help.

Comment thread cmd/gh/main.go Outdated
Comment thread cmd/gh/main.go Outdated
,KMM0;.;:;. dMMMMMMMMK,
:OWMXOOOc dMMMMMWO:
.:kXMMd dMMXk:.
Have a good one~ ,l. .l,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“Have a good one” is a colloquialism, and furthermore one that is not always used in good faith. Keeping non-native English speaking people in mind, could we use something simpler, e.g. “happy hacking!”, or nothing at all?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have a good day?

Comment thread pkg/cmd/auth/auth.go
Comment thread pkg/cmd/factory/http.go Outdated
Comment thread pkg/cmd/root/root.go Outdated
return &cmdutil.FlagError{Err: err}
})

// TODO does this make sense? I'd like people to be able to see usage without an auth message.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm that's a great point. We likely don't want an auth check on commands such as gh, gh pr, gh pr create --help, gh help ..., and similar

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with gh pr create --help not working for now; there's always gh help and that specific help page isn't going to help much without auth (unlike the root help)

Comment thread cmd/gh/main.go Outdated
Comment on lines +114 to +129
'oONMMMMMMMMMMMMNOo'
'dXMMMMMMMMMMMMMMMMMMMMXd'
.kMMMMMMMMMMMMMMMMMMMMMMMMMMk.
To authenticate, please lWMMMM:.'ckXKOkkkkOKXkc'.:MMMMWl
run 'gh auth login'. oMMMMMM. .MMMMMMo
;WMMMMMX. .XMMMMMW;
0MMMMMK. .KMMMMM0
You can also set the MMMMMMl lMMMMMM
GITHUB_TOKEN environment MMMMMMd dMMMMMM
variable, if preferred. KMMMMMN' 'NMMMMMK
cMMMMMMNc cNMMMMMMc
xMMNdkXMNkl;,. .,;lkNMMMMMMMx
xWMNx;kWMMMK. .KMMMMMMMMMWx
,KMM0;.;:;. dMMMMMMMMK,
:OWMXOOOc dMMMMMWO:
.:kXMMd dMMXk:.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ASCII art 😻

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put in a TerminalSize check so as not to print this if the terminal width is too narrow (thanks @tierninho for pointing that out)

@vilmibm
vilmibm requested a review from mislav August 19, 2020 15:23
@AKJK-Internet-Megacorps

This comment has been minimized.

@vilmibm

vilmibm commented Aug 24, 2020

Copy link
Copy Markdown
Contributor Author

cc @ampinsk for ascii art sign off >_>

@ampinsk

ampinsk commented Aug 24, 2020

Copy link
Copy Markdown

I hate to be a bummer, but I don't think we should do the ascii art 😞 I'm concerned about how this will show up for users with voice over! I think it could be really confusing, especially on first run.

I would love to include something welcoming like this though, but maybe that could take the form of emoji if we can exclude Windows (where it won't render correctly)?

@vilmibm

vilmibm commented Aug 24, 2020

Copy link
Copy Markdown
Contributor Author

that's fair, @ampinsk ; for now I've just taken out the ascii art.

@mislav mislav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks and works great, thank you!

Should alias commands be allowed in no-auth mode?

$ gh alias list
Welcome to GitHub CLI!

To authenticate, please run `gh auth login`.

@vilmibm

vilmibm commented Aug 25, 2020

Copy link
Copy Markdown
Contributor Author

good catch @mislav , I just missed aliases when I re-did the disable auth check thing

@vilmibm
vilmibm merged commit 82c6830 into trunk Aug 25, 2020
@mislav
mislav deleted the auth-check branch October 1, 2020 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

don't drop into browser flow when no auth detected

5 participants