微信登录工具
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
杨赟 df52328b0b
init
3 years ago
.gitignore init 3 years ago
README.md init 3 years ago
go.mod init 3 years ago
open.go init 3 years ago
request.go init 3 years ago
wxapp.go init 3 years ago

README.md

微信登录工具

公众号

package main

import (
    "git.oa00.com/go/wx"
)

func main() {
    // 初始化配置
    wx.InitWxopen("appid", "secret")

    // 获取accessToken和openId
    wx.Wxopen.GetAccessInfo("code")

    // 获取用户信息
    wx.Wxopen.GetUserInfo("accessToken", "openId")
}

小程序

package main

import (
    "git.oa00.com/go/wx"
)

func main() {
    // 初始化配置
    wx.InitWxapp("appid","secret")

    // 获取登录信息
    wx.Wxapp.GetLoginInfo("code")

    // 获取用户信息
    wx.Wxapp.GetUserInfo("sessionKey", "encryptedData", "iv")

    // 获取手机号
    wx.Wxapp.GetPhone("sessionKey", "encryptedData", "iv")
}