authorizer

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthOfficial    = 1 // 授权页仅展示公众号
	AuthMiniProgram = 2 // 授权页仅展示小程序
	AuthAll         = 3 // 授权页展示小程序与公众号
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType uint8

AuthType 授权类型

type AuthorizationInfo

type AuthorizationInfo struct {
	AuthorizationInfo AuthorizationInfoBody `json:"authorization_info"`
}

AuthorizationInfo 授权信息

type AuthorizationInfoBody

type AuthorizationInfoBody struct {
	AuthorizerAppid        string     `json:"authorizer_appid"`
	AuthorizerAccessToken  string     `json:"authorizer_access_token"`
	ExpiresIn              int64      `json:"expires_in"`
	AuthorizerRefreshToken string     `json:"authorizer_refresh_token"`
	FuncInfo               []FuncInfo `json:"func_info,omitempty"`
}

type Authorizer

type Authorizer struct {
	// contains filtered or unexported fields
}

Authorizer 公众账号授权

func New

func (*Authorizer) AuthorizationInfo

func (authorizer *Authorizer) AuthorizationInfo(authCode string) (*AuthorizationInfo, error)

AuthorizationInfo 使用授权码获取授权信息

func (*Authorizer) AuthorizerInfo

func (authorizer *Authorizer) AuthorizerInfo(appId string) (*Info, error)

AuthorizerInfo 获取授权帐号详情

func (*Authorizer) MobilePreAuthorizationUrl

func (authorizer *Authorizer) MobilePreAuthorizationUrl(callbackUrl string, authType AuthType) (string, error)

MobilePreAuthorizationUrl 获取移动端公众账号授权链接

func (*Authorizer) PreAuthorizationUrl

func (authorizer *Authorizer) PreAuthorizationUrl(callbackUrl string, authType AuthType) (string, error)

PreAuthorizationUrl 获取公众账号授权链接

type Categories

type Categories struct {
	First  string `json:"first"`
	Second string `json:"second"`
}

type FuncInfo

type FuncInfo struct {
	FuncScopeCategory struct {
		Id int `json:"id"`
	} `json:"funcscope_category,omitempty"`
	ConfirmInfo struct {
		NeedConfirm    int `json:"need_confirm"`
		AlreadyConfirm int `json:"already_confirm"`
		CanConfirm     int `json:"can_confirm"`
	} `json:"confirm_info,omitempty"`
}

type Info

type Info struct {
	AuthorizationInfo AuthorizationInfoBody `json:"authorization_info"`
	// 授权账号详情信息
	AuthorizerInfo InfoBody `json:"authorizer_info"`
}

Info 授权账号详情信息

type InfoBody

type InfoBody struct {
	// 通用字段
	Nickname        string `json:"nick_name"`
	HeadImg         string `json:"head_img"`
	ServiceTypeInfo struct {
		Id int `json:"id"`
	} `json:"service_type_info"`
	VerifyTypeInfo struct {
		Id int `json:"id"`
	} `json:"verify_type_info"`
	Username      string         `json:"user_name"`
	PrincipalName string         `json:"principal_name"`
	BusinessInfo  map[string]int `json:"business_info"`
	Alias         string         `json:"alias"`
	QrcodeUrl     string         `json:"qrcode_url"`
	AccountStatus int            `json:"account_status"`
	Idc           int            `json:"idc"`
	Signature     string         `json:"signature"`

	// 小程序独有字段
	RegisterType    int              `json:"register_type"`
	BasicConfig     map[string]bool  `json:"basic_config"`
	MiniProgramInfo *MiniProgramInfo `json:"MiniProgramInfo"`
}

type MiniProgramInfo

type MiniProgramInfo struct {
	Network     map[string][]string `json:"network"`
	Categories  []Categories        `json:"categories"`
	VisitStatus int                 `json:"visit_status"`
}

type PreAuthCode

type PreAuthCode struct {
	PreAuthCode string `json:"pre_auth_code"`
	ExpiresIn   int64  `json:"expires_in"`
}

PreAuthCode 预授权码

Jump to

Keyboard shortcuts

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