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

Function authRecoveryCommand

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

Source from the content-addressed store, hash-verified

334}
335
336func authRecoveryCommand(cfg gh.Config, httpErr api.HTTPError) string {
337 if httpErr.RequestURL == nil {
338 return "gh auth login"
339 }
340
341 hostname := ghauth.NormalizeHostname(httpErr.RequestURL.Hostname())
342 cred := cfg.Authentication().ActiveToken(hostname)
343 if shared.AuthTokenRefreshable(cred.Token, cred.Source) {
344 return fmt.Sprintf("gh auth refresh -h %s", hostname)
345 }
346
347 return fmt.Sprintf("gh auth login -h %s", hostname)
348}
349
350// printAuthWarnings writes each warning recorded by authCfg to w, prefixed with a warning icon.
351func 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