1 Star 3 Fork 1

潇辰风 / thirdparty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 656 Bytes
一键复制 编辑 原始数据 按行查看 历史
龙龙 提交于 2022-11-02 16:50 . 修改仓库从github 到gitee

thirdparty

Go语言实现的第三方授权登录,整合QQ、微信、微信小程序、微博、抖音、支付宝等第三方平台的授权登录

微信授权登录

package main

import (
	"fmt"
	"gitee.com/cf-soft/thirdparty/oauth"
)

func main()  {
	wxConf := &oauth.AuthConf{
        ClientId: "your app_id", 
        ClientSecret: "your app_secret", 
        RedirectUrl: "http://www.cfsoft.cn"}

	wxAuth := oauth.NewAuthWxWechat(wxConf)
	fmt.Print(wxAuth.GetRedirectUrl("sate")) //获取第三方登录地址
	wxRes, err := wxAuth.GetWebAccessToken("code")
	userInfo, _ := wxAuth.GetUserInfo(wxRes.AccessToken, wxRes.OpenId)
}
Go
1
https://gitee.com/cf-soft/thirdparty.git
git@gitee.com:cf-soft/thirdparty.git
cf-soft
thirdparty
thirdparty
main

搜索帮助