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

Method persistRefreshedCredential

internal/config/refreshable.go:714–724  ·  view source on GitHub ↗

persistRefreshedCredential writes a renewed refreshable credential back to the storage form it already lived in. Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep in sync.

(hostname, username string, credential gh.Credential, secure bool)

Source from the content-addressed store, hash-verified

712// Refreshable credentials are resolved per-user via the active user key, so there is no host-level active copy to keep
713// in sync.
714func (c *AuthConfig) persistRefreshedCredential(hostname, username string, credential gh.Credential, secure bool) error {
715 if secure {
716 if err := c.setRefreshableInKeyring(hostname, username, credential); err != nil {
717 return err
718 }
719 } else {
720 c.setRefreshableInConfig(hostname, username, credential)
721 }
722
723 return ghConfig.Write(c.cfg)
724}
725
726// refreshableTokenRecord is the on-disk and keyring JSON shape of a refreshable credential. It exists solely so the
727// storage helpers can marshal and unmarshal the persisted fields; it never crosses an AuthConfig method boundary,

Callers 2

LogoutWithCredentialMethod · 0.95

Calls 3

WriteMethod · 0.65

Tested by

no test coverage detected