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

Function AuthTokenRefreshable

pkg/cmd/auth/shared/writeable.go:14–16  ·  view source on GitHub ↗

AuthTokenRefreshable reports whether the token is stored by gh and can be renewed with `gh auth refresh`. TODO: this matches a token prefix itself. It could ask gh.AuthConfig.ActiveTokenType instead.

(token, src string)

Source from the content-addressed store, hash-verified

12// TODO: this matches a token prefix itself. It could ask
13// gh.AuthConfig.ActiveTokenType instead.
14func AuthTokenRefreshable(token, src string) bool {
15 return token != "" && !strings.HasSuffix(src, "_TOKEN") && strings.HasPrefix(token, "gho_")
16}
17
18func AuthTokenWriteable(authCfg gh.AuthConfig, hostname string) (string, bool) {
19 token, src := authCfg.ActiveToken(hostname)

Callers 2

StringMethod · 0.92
authRecoveryCommandFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected