const defaultExpiryDelta … type Token … // Type returns t.TokenType if non-empty, else "Bearer". func (t *Token) Type() string { … } // SetAuthHeader sets the Authorization header to r using the access // token in t. // // This method is unnecessary when using Transport or an HTTP Client // returned by this package. func (t *Token) SetAuthHeader(r *http.Request) { … } // WithExtra returns a new Token that's a clone of t, but using the // provided raw extra map. This is only intended for use by packages // implementing derivative OAuth2 flows. func (t *Token) WithExtra(extra interface{ … } // Extra returns an extra field. // Extra fields are key-value pairs returned by the server as a // part of the token retrieval response. func (t *Token) Extra(key string) interface{ … } var timeNow … // expired reports whether the token is expired. // t must be non-nil. func (t *Token) expired() bool { … } // Valid reports whether t is non-nil, has an AccessToken, and is not expired. func (t *Token) Valid() bool { … } // tokenFromInternal maps an *internal.Token struct into // a *Token struct. func tokenFromInternal(t *internal.Token) *Token { … } // retrieveToken takes a *Config and uses that to retrieve an *internal.Token. // This token is then mapped from *internal.Token into an *oauth2.Token which is returned along // with an error.. func retrieveToken(ctx context.Context, c *Config, v url.Values) (*Token, error) { … } type RetrieveError … func (r *RetrieveError) Error() string { … }