Skip to content

Commit b1a6346

Browse files
committed
take out auto browser flow
1 parent 231ed71 commit b1a6346

File tree

2 files changed

+3
-17
lines changed

2 files changed

+3
-17
lines changed

cmd/gh/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,7 @@ func main() {
134134
}
135135
}
136136

137-
// TODO verify host auth in heavy user input commands (creates, review)
138137
// TODO improve error messaging for 401
139-
// TODO remove old auth flow path
140138

141139
rootCmd.SetArgs(expandedArgs)
142140

pkg/cmd/factory/http.go

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package factory
22

33
import (
4-
"errors"
54
"fmt"
65
"net/http"
76
"os"
@@ -30,20 +29,9 @@ func httpClient(io *iostreams.IOStreams, cfg config.Config, appVersion string, s
3029

3130
hostname := ghinstance.NormalizeHostname(req.URL.Hostname())
3231
token, err := cfg.Get(hostname, "oauth_token")
33-
if token == "" {
34-
var notFound *config.NotFoundError
35-
// TODO: check if stdout is TTY too
36-
if errors.As(err, &notFound) && io.IsStdinTTY() {
37-
// interactive OAuth flow
38-
token, err = config.AuthFlowWithConfig(cfg, hostname, "Notice: authentication required", nil)
39-
}
40-
if err != nil {
41-
return "", err
42-
}
43-
if token == "" {
44-
// TODO: instruct user how to manually authenticate
45-
return "", fmt.Errorf("authentication required for %s", hostname)
46-
}
32+
if err != nil || token == "" {
33+
// Users shouldn't see this because of the pre-execute auth check on commands
34+
return "", fmt.Errorf("authentication required for %s; please run `gh auth login -h%s", hostname, hostname)
4735
}
4836

4937
return fmt.Sprintf("token %s", token), nil

0 commit comments

Comments
 (0)