oauth

package
v1.7.6 Latest Latest
Warning

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

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

Documentation

Overview

Package oauth Oauth2授权相关结构体

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenRequest

type AccessTokenRequest struct {
	AppID    uint64 `json:"app_id,omitempty"`
	Secret   string `json:"secret,omitempty"`
	AuthCode string `json:"auth_code,omitempty"`
}

AccessTokenRequest 获取AccessToken APIRequest

func (AccessTokenRequest) Encode

func (r AccessTokenRequest) Encode() []byte

Encode implement PostRequest interface

func (AccessTokenRequest) Url

func (r AccessTokenRequest) Url() string

Url implement PostRequest interface

type AccessTokenResponse

type AccessTokenResponse struct {
	// AccessToken 用于验证权限的token
	AccessToken string `json:"access_token,omitempty"`
	// AccessTokenExpiresIn access_token剩余有效时间,单位:秒
	AccessTokenExpiresIn int64 `json:"access_token_expires_in,omitempty"`
	// RefreshToken 用于获取新的access_token和refresh_token,并且刷新过期时间
	RefreshToken string `json:"refresh_token,omitempty"`
	// RefreshTokenExpiresIn refresh_token剩余有效时间,单位:秒
	RefreshTokenExpiresIn int64 `json:"refresh_token_expires_in,omitempty"`
	// AdvertiserID 广告主ID
	AdvertiserID uint64 `json:"advertiser_id,omitempty"`
	// AdvertiserIDs 已授权账户所有的account_id
	AdvertiserIDs []uint64 `json:"advertiser_ids,omitempty"`
}

AccessTokenResponse 获取AccessToken APIResponse

type RefreshTokenRequest

type RefreshTokenRequest struct {
	// AppID 应用ID
	AppID uint64 `json:"app_id,omitempty"`
	// Secret 应用密钥
	Secret string `json:"secret,omitempty"`
	// RefreshToken 最近一次快手返回的refresh_token
	RefreshToken string `json:"refresh_token,omitempty"`
}

RefreshTokenRequest 刷新Token APIRequest

func (RefreshTokenRequest) Encode

func (r RefreshTokenRequest) Encode() []byte

Encode implement PostRequest inteface

func (RefreshTokenRequest) Url

func (r RefreshTokenRequest) Url() string

Url implement PostRequest interface

type UrlRequest

type UrlRequest struct {
	// AppID 应用ID
	AppID uint64 `json:"app_id,omitempty"`
	// Scope 授权scope
	Scope []string `json:"scope,omitempty"`
	// RedirectUri 申请应用时开发者提供的回调地址,使用时需要UrlEncode一次
	RedirectUri string `json:"redirect_uri,omitempty"`
	// State 自定义参数; 回调时会原样返回,可用于广告主区分不同投放渠道等用途,广告主可选择性使用
	State string `json:"state,omitempty"`
	// OauthType 代理商使用授权URL拼接&oauth_type=agent
	OauthType string `json:"oauth_type,omitempty"`
}

UrlRequest 生成授权链接APIRequest

func (UrlRequest) Encode

func (r UrlRequest) Encode() string

Encode implement GetRequest interface

func (UrlRequest) Url

func (r UrlRequest) Url() string

Url implement GetRequest interface

Jump to

Keyboard shortcuts

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