forked from Mirrors/oauth2
Use default client rather than a new client instance.
This commit is contained in:
parent
648dd50ab3
commit
6b4f2ed2ce
|
@ -76,7 +76,7 @@ func (c *ComputeEngineConfig) FetchToken(existing *oauth2.Token) (token *oauth2.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
req.Header.Add("X-Google-Metadata-Request", "True")
|
req.Header.Add("X-Google-Metadata-Request", "True")
|
||||||
resp, err := (&http.Client{}).Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
3
jwt.go
3
jwt.go
|
@ -100,8 +100,7 @@ func (c *JWTConfig) FetchToken(existing *Token) (token *Token, err error) {
|
||||||
v.Set("assertion", payload)
|
v.Set("assertion", payload)
|
||||||
|
|
||||||
// Make a request with assertion to get a new token.
|
// Make a request with assertion to get a new token.
|
||||||
client := http.Client{}
|
resp, err := http.DefaultClient.PostForm(c.aud, v)
|
||||||
resp, err := client.PostForm(c.aud, v)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ func (c *Config) exchange(exchangeCode string) (*Token, error) {
|
||||||
func (c *Config) updateToken(tok *Token, v url.Values) error {
|
func (c *Config) updateToken(tok *Token, v url.Values) error {
|
||||||
v.Set("client_id", c.opts.ClientID)
|
v.Set("client_id", c.opts.ClientID)
|
||||||
v.Set("client_secret", c.opts.ClientSecret)
|
v.Set("client_secret", c.opts.ClientSecret)
|
||||||
r, err := (&http.Client{}).PostForm(c.tokenURL, v)
|
r, err := http.DefaultClient.PostForm(c.tokenURL, v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue