github.com/infraboard/keyauth@v0.8.1/apps/provider/auth/wxwork/auth_test.go (about) 1 package wxwork_test 2 3 import ( 4 "fmt" 5 "testing" 6 7 "github.com/infraboard/keyauth/apps/provider/auth/wxwork" 8 ) 9 10 func TestAuthCode(t *testing.T) { 11 wx := wxwork.Wechat{ 12 AppID: "wx891xxxxx", // 企业微信app ID 13 AppSecret: "84OrKLxIxxx", // 企业微信app secret 14 AgentID: "1000xxx", // 企业微信 应用ID 15 } 16 token := wx.GetAccessToken() 17 resp := wx.FromCodeGetUserInfo("", token) // code: oauth_code 18 fmt.Printf("%+v\n", resp) 19 fmt.Println("token: ", token) 20 }