Documentation
¶
Index ¶
- func DeleteToken() error
- func GetToken() (*oauth2.Token, error)
- func GetValidToken(clientSecretPath string) (*oauth2.Token, error)
- func HasToken() bool
- func LoadClientConfig(clientSecretPath string) (*oauth2.Config, error)
- func LoginFlow(clientSecretPath string) (*oauth2.Token, error)
- func RefreshToken(clientSecretPath string, token *oauth2.Token) (*oauth2.Token, error)
- func SetToken(token *oauth2.Token) error
- type Identity
- type TokenInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValidToken ¶
GetValidToken returns a valid token, refreshing if necessary
func LoadClientConfig ¶
LoadClientConfig loads OAuth2 config from client_secret.json
func RefreshToken ¶
RefreshToken refreshes an expired token
Types ¶
type Identity ¶
type Identity struct {
Email string
Scopes []string
Audience string
HasSearchConsole bool
HasEmail bool
}
Identity describes who a stored token belongs to and what it is allowed to do. Email is empty unless the token was granted an identity scope, so an older token reports its scopes but not its account - that gap is itself the answer when 'sites' comes back empty.
func FetchIdentity ¶
FetchIdentity asks Google who this access token belongs to. It deliberately does not go through the Search Console service: the whole point is to answer "which account is this?" when Search Console itself is returning nothing.
func (*Identity) DescribeAccount ¶
DescribeAccount renders the account for humans, saying plainly when the token cannot identify itself rather than printing an empty field.