feat: fix issues
This commit is contained in:
@@ -174,6 +174,25 @@ func (a *AuthorizeAccessToken) GetUnionID() string {
|
||||
return a.Unionid
|
||||
}
|
||||
|
||||
type StableAccessToken struct {
|
||||
AccessToken string `json:"access_token,omitempty"`
|
||||
ExpiresIn int64 `json:"expires_in,omitempty"`
|
||||
}
|
||||
|
||||
func (we *Client) GetStableAccessToken() (*StableAccessToken, error) {
|
||||
params := we.wrapParams(map[string]string{
|
||||
"grant_type": "client_credential",
|
||||
})
|
||||
|
||||
var data StableAccessToken
|
||||
_, err := we.client.R().SetSuccessResult(&data).SetBodyJsonMarshal(params).Post("/cgi-bin/stable_token")
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "call /cgi-bin/stable_token failed")
|
||||
}
|
||||
|
||||
return &data, nil
|
||||
}
|
||||
|
||||
func (we *Client) AuthorizeCode2Token(code string) (*AuthorizeAccessToken, error) {
|
||||
params := we.wrapParams(map[string]string{
|
||||
"code": code,
|
||||
|
||||
Reference in New Issue
Block a user