From ff4da5d86831100f296fd7d756d1a46a8848b1d1 Mon Sep 17 00:00:00 2001 From: Tien Nguyen Date: Mon, 16 Dec 2024 14:47:29 -0500 Subject: [PATCH] fix client assertion not send through POST body Signed-off-by: Tien Nguyen --- internal/m2mauth/m2mauth.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/m2mauth/m2mauth.go b/internal/m2mauth/m2mauth.go index f45adca..5840a3e 100644 --- a/internal/m2mauth/m2mauth.go +++ b/internal/m2mauth/m2mauth.go @@ -24,7 +24,6 @@ import ( "encoding/pem" "errors" "fmt" - "io" "net/http" "net/url" "os" @@ -224,7 +223,6 @@ func (m *M2MAuthentication) accessToken() (*okta.AccessToken, error) { return nil, err } - var tokenRequestBuff io.ReadWriter query := url.Values{} tokenRequestURL := fmt.Sprintf(okta.CustomAuthzV1TokenEndpointFormat, m.config.OrgDomain(), m.config.AuthzID()) @@ -232,8 +230,7 @@ func (m *M2MAuthentication) accessToken() (*okta.AccessToken, error) { query.Add("scope", m.config.CustomScope()) query.Add("client_assertion_type", "urn:ietf:params:oauth:client-assertion-type:jwt-bearer") query.Add("client_assertion", clientAssertion) - tokenRequestURL += "?" + query.Encode() - req, err := http.NewRequest("POST", tokenRequestURL, tokenRequestBuff) + req, err := http.NewRequest("POST", tokenRequestURL, strings.NewReader(query.Encode())) if err != nil { return nil, err }