oauth

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAuthorizeUrl

func GetAuthorizeUrl(appid string, redirectUri string, state string) (authorizeUrl string)

构造网页授权链接

如果用户同意授权,页面将跳转至 redirect_uri/?code=CODE&state=STATE

See: https://work.weixin.qq.com/api/doc/90000/90135/91022

GET https://open.weixin.qq.com/connect/oauth2/authorize?appid=CORPID&redirect_uri=REDIRECT_URI&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect

Types

type UserInfo

type UserInfo struct {
	Errcode  int    `json:"errcode"`
	Errmsg   string `json:"errmsg"`
	UserID   string `json:"UserId"`
	DeviceID string `json:"DeviceId"`
}

func GetUserInfo

func GetUserInfo(accessToken string, code string) (userInfo UserInfo, err error)

获取访问用户身份

该接口用于根据code获取成员信息

See: https://work.weixin.qq.com/api/doc/90000/90135/91023

GET https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=ACCESS_TOKEN&code=CODE

Jump to

Keyboard shortcuts

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