authorize

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package authorize mini program authorize

Index

Constants

View Source
const (

	// ScopeUserInfo 获取用户公开信息
	ScopeUserInfo = "user_info"
	// ScopeFansList 粉丝列表
	ScopeFansList = "fans.list"
	// ScopeFollowingList 关注列表
	ScopeFollowingList = "following.list"
	// ScopeFansData 查询创作者粉丝数据
	ScopeFansData = "fans.data"

	// ScopeVideoCreate 上传视频到文件服务器 - 创建抖音视频 -上传图片到文件服务器 - 发布图片
	ScopeVideoCreate = "video.create"
	// ScopeVideoList 列出已发布的视频
	ScopeVideoList = "video.list"
	// ScopeVideoData 查询指定视频数据
	ScopeVideoData = "video.data"
	// ScopeAwemeShare 抖音分享 id 机制
	ScopeAwemeShare = "aweme.share"
	// ScopeVideoDelete 删除抖音视频
	ScopeVideoDelete = "video.delete"
	// ScopeHotSearch 获取实时热点词 --获取热点词聚合的视频
	ScopeHotSearch = "hotsearch"

	// ScopeVideoComment 评论列表 ---评论回复列表 ---回复视频评论 ---置顶视频评论 (企业号)
	ScopeVideoComment = "video.comment"
	// ScopeIm 给抖音用户发送消息  --- 上传素材
	ScopeIm = "im"
)

Variables

This section is empty.

Functions

func GetAllScope

func GetAllScope() string

GetAllScope 获取所有 Scope.

func GetInteractScope

func GetInteractScope() string

GetInteractScope 获取互动相关 Scope.

func GetUserScope

func GetUserScope() string

GetUserScope 获取用户相关 Scope.

func GetVideoScope

func GetVideoScope() string

GetVideoScope 获取视频相关 Scope.

Types

type Authorize

type Authorize struct {
	*credential.ContextConfig
}

Authorize 保存用户授权信息

func NewAuthorize

func NewAuthorize(ctxCfg *credential.ContextConfig) *Authorize

NewAuthorize 实例化授权信息

func (*Authorize) CodeToSession

func (a *Authorize) CodeToSession(ctx context.Context, code, anonymousCode string) (res CodeToSessionData, err error)

CodeToSession 获取用户的 session_key 和 openid

func (*Authorize) GetRedirectURL

func (a *Authorize) GetRedirectURL(_ context.Context, state string) string

GetRedirectURL 获取授权码的 URL 地址

func (*Authorize) GetSilenceOauthURL

func (a *Authorize) GetSilenceOauthURL(_ context.Context, state string) string

GetSilenceOauthURL 获取静默授权码的 URL 地址

func (*Authorize) GetUserAccessToken

func (a *Authorize) GetUserAccessToken(ctx context.Context, code string) (accessToken credential.AccessToken, err error)

GetUserAccessToken 通过网页授权的 code 换取 access_token

type CodeToSessionData

type CodeToSessionData struct {
	SessionKey      string `json:"session_key"`
	Openid          string `json:"openid"`
	AnonymousOpenid string `json:"anonymous_openid"`
	UnionID         string `json:"unionid"`
}

CodeToSessionData 获取用户的 session_key 和 openid

type CodeToSessionReq

type CodeToSessionReq struct {
	Appid         string `json:"appid"`
	Secret        string `json:"secret"`
	AnonymousCode string `json:"anonymous_code"`
	Code          string `json:"code"`
}

CodeToSessionReq 获取用户的 session_key 和 openid 的请求参数

type CodeToSessionRes

type CodeToSessionRes struct {
	ErrNo   int               `json:"err_no"`
	ErrTips string            `json:"err_tips"`
	Data    CodeToSessionData `json:"data"`
}

CodeToSessionRes 获取用户的 session_key 和 openid

Jump to

Keyboard shortcuts

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