MCPcopy Create free account
hub / github.com/cli/cli / authRecoveryCommand

Function authRecoveryCommand

internal/ghcmd/cmd.go:309–321  ·  view source on GitHub ↗
(cfg gh.Config, httpErr api.HTTPError)

Source from the content-addressed store, hash-verified

307}
308
309func authRecoveryCommand(cfg gh.Config, httpErr api.HTTPError) string {
310 if httpErr.RequestURL == nil {
311 return "gh auth login"
312 }
313
314 hostname := ghauth.NormalizeHostname(httpErr.RequestURL.Hostname())
315 cred := cfg.Authentication().ActiveToken(hostname)
316 if shared.AuthTokenRefreshable(cred.Token, cred.Source) {
317 return fmt.Sprintf("gh auth refresh -h %s", hostname)
318 }
319
320 return fmt.Sprintf("gh auth login -h %s", hostname)
321}
322
323// printAuthWarnings writes each warning recorded by authCfg to w, prefixed with a warning icon.
324func printAuthWarnings(w io.Writer, cs *iostreams.ColorScheme, authCfg gh.AuthConfig) {

Callers 2

MainFunction · 0.85
Test_authRecoveryCommandFunction · 0.85

Calls 3

AuthTokenRefreshableFunction · 0.92
ActiveTokenMethod · 0.65
AuthenticationMethod · 0.65

Tested by 1

Test_authRecoveryCommandFunction · 0.68