clientcredentials: allow override of grant_type

This commit is contained in:
Tom Payne
2019-01-18 13:23:58 +01:00
parent 5dab4167f3
commit 0e6f85e31e
2 changed files with 40 additions and 1 deletions

View File

@@ -90,7 +90,9 @@ func (c *tokenSource) Token() (*oauth2.Token, error) {
v.Set("scope", strings.Join(c.conf.Scopes, " "))
}
for k, p := range c.conf.EndpointParams {
if _, ok := v[k]; ok {
// Allow grant_type to be overridden to allow interoperability with
// non-compliant implementations.
if _, ok := v[k]; ok && k != "grant_type" {
return nil, fmt.Errorf("oauth2: cannot overwrite parameter %q", k)
}
v[k] = p