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"` Caption string `json:"caption"`
URI string `json:"uri"` 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) { func (c *Client) auth() (*authRes, error) {
// v := url.Values{} b := AuthPayload{
// v.Add("realm", c.realm) ClientID: c.clientID,
// v.Add("grant_type", "client_credentials") ClientSecret: c.clientSecret,
// v.Add("client_id", c.clientID) }
// v.Add("client_secret", c.clientSecret)
//
// body := v.Encode()
header := map[string]string{ header := map[string]string{
httputil.HeaderKeyContentType: httputil.HeaderValueApplicationJSON, httputil.HeaderKeyContentType: httputil.HeaderValueApplicationJSON,
} }
@ -224,8 +221,8 @@ func (c *Client) auth() (*authRes, error) {
ResponseImmediately: true, ResponseImmediately: true,
Payload: model.HttpRequest{ Payload: model.HttpRequest{
URL: apiURL, URL: apiURL,
Method: http.MethodGet, Method: http.MethodPost,
// Data: body, Data: pjson.ToJSONString(b),
Header: header, Header: header,
}, },
} }