diff --git a/partnerapi/shiip/model_request.go b/partnerapi/shiip/model_request.go index 9a46c37..5ff69d9 100644 --- a/partnerapi/shiip/model_request.go +++ b/partnerapi/shiip/model_request.go @@ -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"` +} diff --git a/partnerapi/shiip/shiip.go b/partnerapi/shiip/shiip.go index 6ba7352..8b7c0e0 100644 --- a/partnerapi/shiip/shiip.go +++ b/partnerapi/shiip/shiip.go @@ -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, }, }