oauth2

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2015 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

OAuth2接口.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCodeURL

func AuthCodeURL(corpId, redirectURL, scope, state string) string

构造获取code的URL.

corpId:      企业的CorpID
redirectURL: 授权后重定向的回调链接地址, 员工点击后,页面将跳转至
             redirect_uri/?code=CODE&state=STATE,企业可根据code参数获得员工的userid。
scope:       应用授权作用域,此时固定为:snsapi_base
state:       重定向后会带上state参数,企业可以填写a-zA-Z0-9的参数值,长度不可超过128个字节

Types

type Client

type Client struct {
	*corp.CorpClient
}

func NewClient

func NewClient(AccessTokenServer corp.AccessTokenServer, httpClient *http.Client) Client

兼容保留, 建議實際項目全局維護一個 *corp.CorpClient

func (Client) UserInfo

func (clt Client) UserInfo(agentId int64, code string) (info *UserInfo, err error)

根据code获取成员信息.

agentId: 跳转链接时所在的企业应用ID
code:    通过员工授权获取到的code,每次员工授权带上的code将不一样,
         code只能使用一次,5分钟未被使用自动过期

type UserInfo

type UserInfo struct {
	UserId   string `json:"UserId"`   // 员工UserID
	DeviceId string `json:"DeviceId"` // 手机设备号(由微信在安装时随机生成)
}

Jump to

Keyboard shortcuts

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