update auth body

This commit is contained in:
Sinh 2022-12-05 09:49:57 +07:00
parent 8c519bbab7
commit d33f3d7063
2 changed files with 11 additions and 9 deletions

View File

@ -55,3 +55,8 @@ type Label struct {
Caption string `json:"caption"`
URI string `json:"uri"`
}
type AuthPayload struct {
ClientID string `json:"clientId"`
ClientSecret string `json:"clientSecret"`
}

View File

@ -209,13 +209,10 @@ func (c *Client) CancelOutboundRequest(requestID int, note string) error {
}
func (c *Client) auth() (*authRes, error) {
// v := url.Values{}
// v.Add("realm", c.realm)
// v.Add("grant_type", "client_credentials")
// v.Add("client_id", c.clientID)
// v.Add("client_secret", c.clientSecret)
//
// body := v.Encode()
b := AuthPayload{
ClientID: c.clientID,
ClientSecret: c.clientSecret,
}
header := map[string]string{
httputil.HeaderKeyContentType: httputil.HeaderValueApplicationJSON,
}
@ -224,8 +221,8 @@ func (c *Client) auth() (*authRes, error) {
ResponseImmediately: true,
Payload: model.HttpRequest{
URL: apiURL,
Method: http.MethodGet,
// Data: body,
Method: http.MethodPost,
Data: pjson.ToJSONString(b),
Header: header,
},
}