Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask for a token, not a password #2742

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions features/authentication.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Feature: OAuth authentication
When I type "mislav"
And I type "kitty"
Then the output should contain "github.com username:"
And the output should contain "github.com password for mislav (never stored):"
And the output should contain "github.com access token with scope 'repo' for mislav (generate one at https://github.com/settings/tokens):"
And the exit status should be 0
And the file "~/.config/hub" should contain "user: MiSlAv"
And the file "~/.config/hub" should contain "oauth_token: OTOKEN"
Expand Down Expand Up @@ -159,7 +159,7 @@ Feature: OAuth authentication
Given $GITHUB_USER is "mislav"
And $GITHUB_PASSWORD is "kitty"
When I successfully run `hub create`
Then the output should not contain "github.com password for mislav"
Then the output should not contain "github.com access token with scope 'repo' for mislav"
And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"

Scenario: XDG: legacy config found, credentials from GITHUB_USER & GITHUB_PASSWORD
Expand Down Expand Up @@ -371,7 +371,7 @@ Feature: OAuth authentication
When I type "mislav"
And I type "kitty"
And I type "112233"
Then the output should contain "github.com password for mislav (never stored):"
Then the output should contain "github.com access token with scope 'repo' for mislav (generate one at https://github.com/settings/tokens):"
Then the output should contain "two-factor authentication code:"
And the output should not contain "warning: invalid two-factor code"
And the exit status should be 0
Expand Down Expand Up @@ -429,7 +429,7 @@ Feature: OAuth authentication
When I run `hub create` interactively
When I type "[email protected]"
And I type "my pass@phrase ok?"
Then the output should contain "github.com password for [email protected] (never stored):"
Then the output should contain "github.com access token with scope 'repo' for [email protected] (generate one at https://github.com/settings/tokens):"
And the exit status should be 0
And the file "../home/.config/hub" should contain "user: mislav"
And the file "../home/.config/hub" should contain "oauth_token: OTOKEN"
Expand Down Expand Up @@ -457,7 +457,7 @@ Feature: OAuth authentication
When I run `hub fork` interactively
And I type "mislav"
And I type "kitty"
Then the output should contain "git.my.org password for mislav (never stored):"
Then the output should contain "git.my.org access token with scope 'repo' for mislav (generate one at https://git.my.org/settings/tokens):"
And the exit status should be 0
And the file "../home/.config/hub" should contain "git.my.org"
And the file "../home/.config/hub" should contain "user: mislav"
Expand Down
2 changes: 1 addition & 1 deletion github/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func (c *Config) PromptForPassword(host, user string) (pass string) {
return
}

ui.Printf("%s password for %s (never stored): ", host, user)
ui.Printf("%s access token with scope 'repo' for %s (generate one at https://%s/settings/tokens): ", host, user, host)
if ui.IsTerminal(os.Stdin) {
if password, err := getPassword(); err == nil {
pass = password
Expand Down