I think there's something fishy about clientcredentials.  Having
trouble with client_secrets containig special chars, first I modified
clientcredentials_test.go like this:

> func TestTokenRequest(t *testing.T) {
> cfg := newConf("")
> data := fmt.Sprintf("%s:%s", cfg.ClientID, cfg.ClientSecret)
> sEnc := base64.StdEncoding.EncodeToString([]byte(data))
> ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r 
*http.Request) {
> if r.URL.String() != "/token" {
> t.Errorf("authenticate client request URL = %q; want %q", r.URL, "/token")
> }
> headerAuth := r.Header.Get("Authorization")
> if headerAuth != "Basic "+sEnc {
> ...

"go test ." succeeded, obviously.

Then I modified the client_secret:

> ClientSecret:   "CLIENT_SECRET=",

Now "go test ." failed!

Changing internal/token.go like this:

> if !bustedAuth {
> //req.SetBasicAuth(url.QueryEscape(clientID), 
url.QueryEscape(clientSecret))
> req.SetBasicAuth(clientID, clientSecret)
> }

made "go test ." succeed again.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to