MCPcopy Index your code
hub / github.com/TruthHun/BookStack / GetWechatSessKey

Function GetWechatSessKey

oauth/wechat.go:34–49  ·  view source on GitHub ↗
(appId, secret, code string)

Source from the content-addressed store, hash-verified

32}
33
34func GetWechatSessKey(appId, secret, code string) (sess *SessKey, err error) {
35 var resp string
36 api := fmt.Sprintf("https://api.weixin.qq.com/sns/jscode2session?appid=%v&secret=%v&js_code=%v&grant_type=authorization_code", appId, secret, code)
37
38 resp, err = httplib.Get(api).SetTimeout(60*time.Second, 60*time.Second).SetTLSClientConfig(&tls.Config{InsecureSkipVerify: true}).String()
39 if err != nil {
40 beego.Error(err.Error())
41 return
42 }
43 if beego.AppConfig.String("runmode") == "dev" {
44 beego.Debug(api, resp)
45 }
46 sess = &SessKey{}
47 json.Unmarshal([]byte(resp), sess)
48 return
49}

Callers 1

LoginByWechatMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected