Documentation ¶
Overview ¶
Package auth is a set of functions for retrieving authentication tokens and authenticated hosts.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHost ¶
DefaultHost retrieves an authenticated host and the source of host. The source can be either an environment variable or from the configuration file. Returns "github.com", "default" if no viable host is found.
func KnownHosts ¶
func KnownHosts() []string
KnownHosts retrieves a list of hosts that have corresponding authentication tokens, either from environment variables or from the configuration file. Returns an empty string slice if no hosts are found.
func TokenForHost ¶
TokenForHost retrieves an authentication token and the source of that token for the specified host. The source can be either an environment variable, configuration file, or the system keyring. In the latter case, this shells out to "gh auth token" to obtain the token.
Returns "", "default" if no applicable token is found.
func TokenFromEnvOrConfig ¶
TokenFromEnvOrConfig retrieves an authentication token from environment variables or the config file as fallback, but does not support reading the token from system keyring. Most consumers should use TokenForHost.
Types ¶
This section is empty.