mirror of
https://github.com/golang/oauth2.git
synced 2025-07-21 00:00:09 +08:00
App Engine Managed VMs should depend on url fetcher.
This commit is contained in:
parent
0f597d5ad4
commit
4901e89da7
@ -3,11 +3,12 @@
|
|||||||
package google
|
package google
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/oauth2"
|
"github.com/golang/oauth2"
|
||||||
|
|
||||||
"google.golang.org/appengine"
|
"google.golang.org/appengine"
|
||||||
|
"google.golang.org/appengine/urlfetch"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AppEngineConfig represents a configuration for an
|
// AppEngineConfig represents a configuration for an
|
||||||
@ -26,7 +27,12 @@ func NewAppEngineConfig(context appengine.Context, scopes []string) *AppEngineCo
|
|||||||
// NewTransport returns a transport that authorizes
|
// NewTransport returns a transport that authorizes
|
||||||
// the requests with the application's service account.
|
// the requests with the application's service account.
|
||||||
func (c *AppEngineConfig) NewTransport() oauth2.Transport {
|
func (c *AppEngineConfig) NewTransport() oauth2.Transport {
|
||||||
return oauth2.NewAuthorizedTransport(http.DefaultTransport, 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.
|
// FetchToken fetches a new access token for the provided scopes.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user