diff --git a/google/appengine.go b/google/appengine.go index 51120a8..b995c21 100644 --- a/google/appengine.go +++ b/google/appengine.go @@ -14,7 +14,6 @@ import ( type AppEngineConfig struct { context appengine.Context scopes []string - cache oauth2.Cache } // NewAppEngineConfig creates a new AppEngineConfig for the @@ -32,12 +31,7 @@ func (c *AppEngineConfig) NewTransport() oauth2.Transport { // NewTransport returns a token-caching transport that authorizes // the requests with the application's service account. func (c *AppEngineConfig) NewTransportWithCache(cache oauth2.Cache) (oauth2.Transport, error) { - token, err := cache.Read() - if err != nil { - return nil, err - } - c.cache = cache - return oauth2.NewAuthorizedTransport(c, token), nil + return oauth2.NewAuthorizedTransportWithCache(c, cache) } // FetchToken fetches a new access token for the provided scopes. @@ -51,7 +45,3 @@ func (c *AppEngineConfig) FetchToken(existing *oauth2.Token) (*oauth2.Token, err Expiry: expiry, }, nil } - -func (c *AppEngineConfig) Cache() oauth2.Cache { - return c.cache -} diff --git a/google/appenginevm.go b/google/appenginevm.go index 1a6ff37..052b395 100644 --- a/google/appenginevm.go +++ b/google/appenginevm.go @@ -32,12 +32,7 @@ func (c *AppEngineConfig) NewTransport() oauth2.Transport { // NewTransport returns a token-caching transport that authorizes // the requests with the application's service account. func (c *AppEngineConfig) NewTransportWithCache(cache oauth2.Cache) (oauth2.Transport, error) { - token, err := cache.Read() - if err != nil { - return nil, err - } - c.cache = cache - return oauth2.NewAuthorizedTransport(c, token), nil + return oauth2.NewAuthorizedTransportWithCache(c, cache) } // FetchToken fetches a new access token for the provided scopes. @@ -51,7 +46,3 @@ func (c *AppEngineConfig) FetchToken(existing *oauth2.Token) (*oauth2.Token, err Expiry: expiry, }, nil } - -func (c *AppEngineConfig) Cache() oauth2.Cache { - return c.cache -}