Skip to content

Commit

Permalink
Merge pull request #2 from vxirau/token-fix
Browse files Browse the repository at this point in the history
Changed token creation to URL - Encoded
  • Loading branch information
Madh93 authored Jul 15, 2024
2 parents 6b55e68 + 730a7a6 commit 9bb117d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/woffuapi/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,16 @@ func (w WoffuAPI) CreateToken() (*TokenResponse, error) {
credentials := strings.Split(w.auth.Credentials(), ":")

// Build API Request
body := fmt.Sprintf("grant_type=password&username=%s&password=%s", credentials[0], credentials[1])
apiRequest := APIRequest{
method: "POST",
endpoint: "/token",
headers: map[string]string{
"Accept": "application/json",
"Content-Type": "application/json",
"Content-Type": "application/x-www-form-urlencoded",
},
// Credentials need to be passed in the body :S
body: []byte(fmt.Sprintf("grant_type=password&username=%s&password=%s", credentials[0], credentials[1])),
body: []byte(body),
}

// Get Token
Expand Down

0 comments on commit 9bb117d

Please sign in to comment.