刷新token

master
杨赟 2 years ago
parent 4da6f21d24
commit 89253cea7f

@ -67,13 +67,13 @@ func exec(action string, data string, result interface{}) error {
respErr := RespErr{} respErr := RespErr{}
json.Unmarshal(bytes, &respErr) json.Unmarshal(bytes, &respErr)
if respErr.ErrorResponse.Code != "" { if respErr.ErrorResponse.Code != "" {
if respErr.ErrorResponse.Code == "19" && config.SdkConfig.RefreshTokenCallback != nil { //if respErr.ErrorResponse.Code == "19" && config.SdkConfig.RefreshTokenCallback != nil {
token, err := RefreshToken() // token, err := RefreshToken()
if err != nil { // if err != nil {
return err // return err
} // }
config.SdkConfig.RefreshTokenCallback(token) // config.SdkConfig.RefreshTokenCallback(token)
} //}
return errors.New(respErr.ErrorResponse.ZhDesc) return errors.New(respErr.ErrorResponse.ZhDesc)
} }
mResp := map[string]resp{} mResp := map[string]resp{}
@ -291,6 +291,7 @@ func RefreshToken() (*config.Bearer, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Println(string(data))
var b config.Bearer var b config.Bearer
if err = json.Unmarshal(data, &b); err != nil { if err = json.Unmarshal(data, &b); err != nil {
return nil, err return nil, err

Loading…
Cancel
Save