github.com/chanxuehong/wechat@v0.0.0-20230222024006-36f0325263cd/mp/oauth2/api_test.go (about) 1 package oauth2 2 3 import ( 4 "fmt" 5 "testing" 6 ) 7 8 const ( 9 wxAppId = "" // 填上自己的参数 10 wxAppSecret = "" // 填上自己的参数 11 //oauth2RedirectURI = "http://192.168.1.129:8080/page2" // 填上自己的参数 12 //oauth2Scope = "snsapi_userinfo" // 填上自己的参数 13 ) 14 15 var ( 16 oauth2Endpoint *Endpoint = NewEndpoint(wxAppId, wxAppSecret) 17 ) 18 19 func TestGetSession(t *testing.T) { 20 21 GetSession(oauth2Endpoint, "013Rc7FP0lmgxb2lRIIP0VefFP0Rc7FW") 22 } 23 24 func TestGetUserInfoBySession(t *testing.T) { 25 26 sessionKey := "" 27 28 iv := "" 29 30 encrypt := "" 31 32 info, err := GetSessionInfo(encrypt, sessionKey, iv) 33 34 fmt.Println(info) 35 36 fmt.Println(err) 37 }