oauth2: don't use http.DefaultTransport.

http.DefaultTransport is not available on App Engine.
This commit is contained in:
Burcu Dogan
2014-07-11 10:57:28 -07:00
parent 958c47866e
commit 0f597d5ad4
8 changed files with 37 additions and 27 deletions

View File

@@ -8,6 +8,7 @@ import (
"github.com/golang/oauth2"
"appengine"
"appengine/urlfetch"
)
// AppEngineConfig represents a configuration for an
@@ -26,7 +27,12 @@ func NewAppEngineConfig(context appengine.Context, scopes []string) *AppEngineCo
// NewTransport returns a transport that authorizes
// the requests with the application's service account.
func (c *AppEngineConfig) NewTransport() oauth2.Transport {
return oauth2.NewAuthorizedTransport(c, nil)
transport := &urlfetch.Transport{
Context: c.context,
Deadline: 0,
AllowInvalidServerCertificate: false,
}
return oauth2.NewAuthorizedTransport(transport, c, nil)
}
// FetchToken fetches a new access token for the provided scopes.