oauth2

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2022 License: Zlib Imports: 11 Imported by: 0

Documentation

Overview

*

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(tk token.Token, d data.D) (access.Token, error)

GetAccessToken 官司说明 https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421140842 微信网页通过code 授权access_token, 这个授权只是某一个具体的app,某个具体openid对应的access_token

Types

type Phone

type Phone struct {
	User
	//用户绑定的手机号(国外手机号会有区号)
	PhoneNumber string `json:"phoneNumber,omitempty"`

	//没有区号的手机号
	PurePhoneNumber string `json:"purePhoneNumber,omitempty"`

	//区号
	CountryCode string `json:"countryCode,omitempty"`
}

type User

type User struct {
	OpenId    string   `json:"openid"`
	UnionId   string   `json:"unionid,omitempty"` //开发者最好保存用户unionID信息,以便以后在不同应用中进行用户信息互通。
	Nick      string   `json:"nickname,omitempty"`
	Sex       int8     `json:"sex,omitempty"`
	ImgUrl    string   `json:"headimgurl,omitempty"`
	Province  string   `json:"province,omitempty"`
	City      string   `json:"city,omitempty"`
	Country   string   `json:"country,omitempty"`
	Privilege []string `json:"privilege,omitempty"`
	Language  string   `json:"language,omitempty"`
	AppId     string   `json:"appid"`
}

func GetUser

func GetUser(api *api.Api, openid string) (*User, error)

GET https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s 通过access_token和openid获取用户的基础信息,包括头像、昵称、性别、地区

type UserEx

type UserEx struct {
	User
	Subscribe      int     `json:"subscribe"`
	SubscribeTime  int64   `json:"subscribe_time,omitempty"`
	Remark         string  `json:"remark,omitempty"`
	GroupId        int64   `json:"groupid,omitempty"`
	TagIds         []int64 `json:"tagid_list,omitempty"`
	SubscribeScene string  `json:"subscribe_scene,omitempty"`
	QRSceneId      int32   `json:"qr_scene,omitempty"`
	QRSceneStr     string  `json:"qr_scene_str,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL