oauth

package
v1.3.5 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package oauth OAuth授权相关

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	// AccessToken 授权令牌
	AccessToken string `json:"accessToken,omitempty"`
	// RefreshToken 刷新令牌
	RefreshToken string `json:"refreshToken,omitempty"`
	// OpenID 获取授权用户信息标识
	OpenID string `json:"openId,omitempty"`
	// ExpiresTime 授权令牌到期时间
	ExpiresTime string `json:"expiresTime,omitempty"`
	// RefreshExpiresTime 更新令牌到期时间
	RefreshExpiresTime string `json:"refreshExpiresTime,omitempty"`
	// ExpiresIn 授权令牌剩余有效时间
	ExpiresIn int64 `json:"expiresIn,omitempty"`
	// RefreshExpiresIn 更新令牌剩余有效时间
	RefreshExpiresIn int64 `json:"refreshExpiresIn,omitempty"`
	// UserID 授权账号 ucid
	UserID uint64 `json:"userId,omitempty"`
}

AccessToken 授权令牌

type AccessTokenRequest

type AccessTokenRequest struct {
	// AppID 应用 appid
	AppID string `json:"appId,omitempty"`
	// AuthCode 临时授权码(数据来源:通过回调接口获取)
	AuthCode string `json:"authCode,omitempty"`
	// SecretKey 应用持有的 secretKey
	SecretKey string `json:"secretKey,omitempty"`
	// GrantType 授权令牌获取模式,仅限:auth_code(授权码模式)
	GrantType string `json:"grantType,omitempty"`
	// UserID 同意授权的推广账户ID(数据来源:通过回调接口获取)
	UserID uint64 `json:"userId,omitempty"`
}

AccessTokenRequest 换取授权令牌接口

func (AccessTokenRequest) Url

func (r AccessTokenRequest) Url() string

Url implement RequestBody interface

type GetUserInfoRequest

type GetUserInfoRequest struct {
	// OpenID 授权用户查询标识
	OpenID string `json:"openId,omitempty"`
	// AccessToken 已有的授权令牌
	AccessToken string `json:"accessToken,omitempty"`
	// UserID 同意授权的推广账户ID
	UserID uint64 `json:"userId,omitempty"`
	// NeedSubList 是否需要子账号列表,值为true时返回subUserList
	NeedSubList bool `json:"needSubList,omitempty"`
	// PageSize 分页数量,默认100,最大不超过500
	PageSize int `json:"pageSize,omitempty"`
	// LastPageMaxUcId 上一页返回的最大userid,用于子账号列表分页
	// 查询子账号列表时,该字段为必填。第一次获取子账户列表时,该字段需要设置为1
	LastPageMaxUcId uint64 `json:"lastPageMaxUcId,omitempty"`
}

GetUserInfoRequest 查询授权用户信息

func (GetUserInfoRequest) Url

func (r GetUserInfoRequest) Url() string

Url implement RequestBody interface

type RefreshTokenRequest

type RefreshTokenRequest struct {
	// AppID 应用ID
	AppID string `json:"appId,omitempty"`
	// RefreshToken 已有的更新令牌 refreshToken
	RefreshToken string `json:"refreshToken,omitempty"`
	// SecretKey 应用密钥
	SecretKey string `json:"secretKey,omitempty"`
	// UserID 同意授权的推广账户ID
	UserID uint64 `json:"userId,omitempty"`
}

RefreshTokenRequest 更新授权令牌接口

func (RefreshTokenRequest) Url

func (r RefreshTokenRequest) Url() string

Url implement RequestBody interface

type SubUserInfo

type SubUserInfo struct {
	// UcId 同意授权用户关联的子账号ucid
	UcId uint64 `json:"ucId,omitempty"`
	// UcName 同意授权用户关联的子账号ucname
	UcName string `json:"ucName,omitempty"`
}

SubUserInfo 同意授权用户关联的子账号

type URLRequest

type URLRequest struct {
	// AppID 需要授权的应用 ID
	AppID string `json:"appId,omitempty"`
	// Scope 应用权限代码,建议从应用管理界面系统生成的授权链接中获取。
	Scope string `json:"scope,omitempty"`
	// State 开发者自定义参数,长度限制 512 个字符,特殊字符需要 URLEncode
	State string `json:"state,omitempty"`
	// Callback 应用回调链接
	Callback string `json:"callback,omitempty"`
}

URLRequest 程序化拼接授权链接 API Request

func (URLRequest) URL

func (r URLRequest) URL() string

URL 程序化拼接授权链接

type UserInfo

type UserInfo struct {
	// MasterUid 同意授权用户ucid
	MasterUid uint64 `json:"masterUid,omitempty"`
	// MasterName 同意授权用户对应的ucname
	MasterName string `json:"masterName,omitempty"`
	// UserAcctType 授权账户类型
	// 1: 普通账户
	// 2:超管账户(客户中心和账户管家)
	UserAcctType int `json:"userAcctType,omitempty"`
	// HasNext 是否有下一页子账号列表
	HasNext bool `json:"hasNext,omitempty"`
	// SubUserList 同意授权用户关联的子账号列表
	SubUserList []SubUserInfo `json:"subUserList,omitempty"`
}

UserInfo 授权用户信息

Jump to

Keyboard shortcuts

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