微信登录工具
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
2 years ago
.gitignore init 2 years ago
README.md init 2 years ago
go.mod init 2 years ago
open.go init 2 years ago
request.go init 2 years ago
wxapp.go init 2 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")
}