forked from Mirrors/oauth2
internal: decapitalize the argument names
Change-Id: I108ea0e49c5a96afb616918b9367085c159fb157 Reviewed-on: https://go-review.googlesource.com/24770 Reviewed-by: Andrew Gerrand <adg@golang.org> Reviewed-by: Chris Broadfoot <cbro@golang.org>
This commit is contained in:
parent
df5b72659a
commit
7357e96168
|
@ -146,23 +146,23 @@ func providerAuthHeaderWorks(tokenURL string) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func RetrieveToken(ctx context.Context, ClientID, ClientSecret, TokenURL string, v url.Values) (*Token, error) {
|
func RetrieveToken(ctx context.Context, clientID, clientSecret, tokenURL string, v url.Values) (*Token, error) {
|
||||||
hc, err := ContextClient(ctx)
|
hc, err := ContextClient(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
v.Set("client_id", ClientID)
|
v.Set("client_id", clientID)
|
||||||
bustedAuth := !providerAuthHeaderWorks(TokenURL)
|
bustedAuth := !providerAuthHeaderWorks(tokenURL)
|
||||||
if bustedAuth && ClientSecret != "" {
|
if bustedAuth && clientSecret != "" {
|
||||||
v.Set("client_secret", ClientSecret)
|
v.Set("client_secret", clientSecret)
|
||||||
}
|
}
|
||||||
req, err := http.NewRequest("POST", TokenURL, strings.NewReader(v.Encode()))
|
req, err := http.NewRequest("POST", tokenURL, strings.NewReader(v.Encode()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
|
||||||
if !bustedAuth {
|
if !bustedAuth {
|
||||||
req.SetBasicAuth(ClientID, ClientSecret)
|
req.SetBasicAuth(clientID, clientSecret)
|
||||||
}
|
}
|
||||||
r, err := hc.Do(req)
|
r, err := hc.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue