Skip to content

Commit e011882

Browse files
committed
feat: remove query escaping of base64 encoded credentials
1 parent e067960 commit e011882

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

internal/token.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,9 @@ func newTokenRequest(tokenURL, clientID, clientSecret string, v url.Values, auth
196196
}
197197
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
198198
if authStyle == AuthStyleInHeader {
199-
req.SetBasicAuth(url.QueryEscape(clientID), url.QueryEscape(clientSecret))
199+
// NOTE: This should be query-escaped, however the Aviva OAuth
200+
// server does not accept query-escaped credentials.
201+
req.SetBasicAuth(clientID, clientSecret)
200202
}
201203
return req, nil
202204
}

oauth2_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func TestAuthCodeURL_Optional(t *testing.T) {
7474

7575
func TestURLUnsafeClientConfig(t *testing.T) {
7676
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
77-
if got, want := r.Header.Get("Authorization"), "Basic Q0xJRU5UX0lEJTNGJTNGOkNMSUVOVF9TRUNSRVQlM0YlM0Y="; got != want {
77+
if got, want := r.Header.Get("Authorization"), "Basic Q0xJRU5UX0lEPz86Q0xJRU5UX1NFQ1JFVD8/"; got != want {
7878
t.Errorf("Authorization header = %q; want %q", got, want)
7979
}
8080

0 commit comments

Comments
 (0)