Skip to content

Commit

Permalink
fix client assertion not send through POST body
Browse files Browse the repository at this point in the history
Signed-off-by: Tien Nguyen <[email protected]>
  • Loading branch information
duytiennguyen-okta committed Dec 16, 2024
1 parent bb688ab commit ff4da5d
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions internal/m2mauth/m2mauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"encoding/pem"
"errors"
"fmt"
"io"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -224,16 +223,14 @@ 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())

query.Add("grant_type", "client_credentials")
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
}
Expand Down

0 comments on commit ff4da5d

Please sign in to comment.