// 设置授权配置
func (comp *Client) SetSessionInfo(ctx context.Context, req *request.SetSessionInfoRequest) error {
_, err := comp.BaseClient.HttpPostJson(ctx, "cgi-bin/service/set_session_info", req, nil, nil, nil)
return err
}
type SetSessionInfoRequest struct {
// PreAuthCode 预授权码
PreAuthCode string `json:"pre_auth_code,omitempty"`
// SessionInfo 本次授权过程中需要用到的会话信息
}
// SessionInfo 本次授权过程中需要用到的会话信息
type SessionInfo struct {
// AppID 允许进行授权的应用id,如1、2、3, 不填或者填空数组都表示允许授权套件内所有应用(仅旧的多应用套件可传此参数,新开发者可忽略)
AppID []uint64 `json:"appid,omitempty"`
// AuthType 授权类型:0 正式授权, 1 测试授权。 默认值为0。注意,请确保应用在正式发布后的授权类型为“正式授权”
AuthType int `json:"auth_type,omitempty"`
}
{
"pre_auth_code":"xxxxx",
"session_info":
{
"appid":[1,2,3],
"auth_type":1
}
}
企业微信文档:https://developer.work.weixin.qq.com/document/10975#%E8%AE%BE%E7%BD%AE%E6%8E%88%E6%9D%83%E9%85%8D%E7%BD%AE
其中使用的request:
与官网文档中的请求体:
不一致了