// Token uses client credentials to retrieve a token. // The HTTP client to use is derived from the context. // If nil, http.DefaultClient is used. func (c *Config) Token(ctx context.Context) (*oauth2.Token, error) { return retrieveToken(ctx, c, url.Values{ "grant_type": {"client_credentials"}, "scope": internal.CondVal(strings.Join(c.Scopes, " ")), }) }
// Token refreshes the token by using a new client credentials request. // tokens received this way do not include a refresh token func (c *tokenSource) Token() (*oauth2.Token, error) { return retrieveToken(c.ctx, c.conf, url.Values{ "grant_type": {"client_credentials"}, "scope": internal.CondVal(strings.Join(c.conf.Scopes, " ")), }) }