oauth

package
v0.0.0-...-a0c205e Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Oauth

type Oauth struct {
	*context.Context
}

Oauth 保存用户授权信息

func NewOauth

func NewOauth(context *context.Context) *Oauth

NewOauth 实例化授权信息

func (*Oauth) GetRedirectURL

func (oauth *Oauth) GetRedirectURL(appid, redirectUri, state string) (string, error)

GetRedirectURL 构造网页授权链接

func (*Oauth) GetUserId

func (oauth *Oauth) GetUserId(accessToken, code string) (result UserId, err error)

GetUserId 获取用户在企业中ID

func (*Oauth) GetWebAppRedirectURL

func (oauth *Oauth) GetWebAppRedirectURL(appid, redirectUri, state string) (string, error)

GetWebAppRedirectURL 构造扫码登录链接

func (*Oauth) Redirect

func (oauth *Oauth) Redirect(writer http.ResponseWriter, req *http.Request, appid, redirectURI, state string) error

Redirect 跳转到网页授权

type UserId

type UserId struct {
	util.CommonError
	UserId   string `json:"UserId"`   // 当用户为企业成员返回此字段
	OpenId   string `json:"OpenId"`   // 非企业成员授权时返回此字段
	DeviceId string `json:"DeviceId"` // 手机设备号(由企业微信在安装时随机生成,删除重装会改变,升级不受影响)
}

UserId 获取用户信息

Jump to

Keyboard shortcuts

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