aboutsummaryrefslogtreecommitdiff
path: root/vendor/golang.org/x/oauth2/internal/token.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/golang.org/x/oauth2/internal/token.go')
-rw-r--r--vendor/golang.org/x/oauth2/internal/token.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/vendor/golang.org/x/oauth2/internal/token.go b/vendor/golang.org/x/oauth2/internal/token.go
index 018b58a..cf959ea 100644
--- a/vendor/golang.org/x/oauth2/internal/token.go
+++ b/vendor/golang.org/x/oauth2/internal/token.go
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// Package internal contains support packages for oauth2 package.
package internal
import (
@@ -18,6 +17,7 @@ import (
"time"
"golang.org/x/net/context"
+ "golang.org/x/net/context/ctxhttp"
)
// Token represents the crendentials used to authorize
@@ -105,6 +105,7 @@ var brokenAuthHeaderProviders = []string{
"https://graph.facebook.com", // see https://github.com/golang/oauth2/issues/214
"https://login.microsoftonline.com/",
"https://login.salesforce.com/",
+ "https://login.windows.net",
"https://oauth.sandbox.trainingpeaks.com/",
"https://oauth.trainingpeaks.com/",
"https://oauth.vk.com/",
@@ -120,11 +121,13 @@ var brokenAuthHeaderProviders = []string{
"https://www.wunderlist.com/oauth/",
"https://api.patreon.com/",
"https://sandbox.codeswholesale.com/oauth/token",
+ "https://api.sipgate.com/v1/authorization/oauth",
}
// brokenAuthHeaderDomains lists broken providers that issue dynamic endpoints.
var brokenAuthHeaderDomains = []string{
".force.com",
+ ".myshopify.com",
".okta.com",
".oktapreview.com",
}
@@ -184,9 +187,9 @@ func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string,
}
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
if !bustedAuth {
- req.SetBasicAuth(clientID, clientSecret)
+ req.SetBasicAuth(url.QueryEscape(clientID), url.QueryEscape(clientSecret))
}
- r, err := hc.Do(req)
+ r, err := ctxhttp.Do(ctx, hc, req)
if err != nil {
return nil, err
}