forked from remote/oauth2
clientcredentials: allow override of grant_type
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user