Documentation ¶
Overview ¶
Package authorize mini program authorize
Index ¶
- Constants
- func GetAllScope() string
- func GetInteractScope() string
- func GetUserScope() string
- func GetVideoScope() string
- type Authorize
- func (a *Authorize) CodeToSession(ctx context.Context, code, anonymousCode string) (res CodeToSessionData, err error)
- func (a *Authorize) GetRedirectURL(_ context.Context, state string) string
- func (a *Authorize) GetSilenceOauthURL(_ context.Context, state string) string
- func (a *Authorize) GetUserAccessToken(ctx context.Context, code string) (accessToken credential.AccessToken, err error)
- type CodeToSessionData
- type CodeToSessionReq
- type CodeToSessionRes
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 = "aweme.share" // ScopeVideoDelete 删除抖音视频 ScopeVideoDelete = "video.delete" // ScopeHotSearch 获取实时热点词 --获取热点词聚合的视频 ScopeHotSearch = "hotsearch" // ScopeVideoComment 评论列表 ---评论回复列表 ---回复视频评论 ---置顶视频评论 (企业号) ScopeVideoComment = "video.comment" // ScopeIm 给抖音用户发送消息 --- 上传素材 ScopeIm = "im" )
Variables ¶
This section is empty.
Functions ¶
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 ¶
GetRedirectURL 获取授权码的 URL 地址
func (*Authorize) GetSilenceOauthURL ¶
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
Click to show internal directories.
Click to hide internal directories.