Skip to content

Commit

Permalink
fix(oauth): issuse #52
Browse files Browse the repository at this point in the history
  • Loading branch information
bububa committed Nov 7, 2024
1 parent e3ee298 commit 80f93a8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
16 changes: 10 additions & 6 deletions model/oauth/access_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import "encoding/json"

// AccessTokenRequest 获取AccessToken APIRequest
type AccessTokenRequest struct {
// AppID 申请应用后快手返回的 app_id
AppID uint64 `json:"app_id,omitempty"`
// Secret 申请应用后快手返回的 secret
Secret string `json:"secret,omitempty"`
// AuthCode 授权时返回的 auth_code
AuthCode string `json:"auth_code,omitempty"`
// AppID 申请应用后快手返回的 app_id
AppID uint64 `json:"app_id,omitempty"`
}

// Url implement PostRequest interface
Expand All @@ -27,14 +27,18 @@ func (r AccessTokenRequest) Encode() []byte {
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"`
// AdvertiserIDs 已授权账户所有的account_id
AdvertiserIDs []uint64 `json:"advertiser_ids,omitempty"`
// AccessTokenExpiresIn access_token剩余有效时间,单位:秒
AccessTokenExpiresIn int64 `json:"access_token_expires_in,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"`
// UserID
UserID uint64 `json:"user_id,omitempty"`
// ApproveType
ApprovalType int `json:"approval_type,omitempty"`
}
4 changes: 2 additions & 2 deletions model/oauth/approval_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import "encoding/json"

// ApprovalListRequest 拉取token下授权广告账户接口 API Request
type ApprovalListRequest struct {
// AppID 申请应用后快手返回的 app_id
AppID uint64 `json:"app_id,omitempty"`
// Secret 申请应用后快手返回的 secret
Secret string `json:"secret,omitempty"`
// AccessToken 查询的 access_token
AccessToken string `json:"access_token,omitempty"`
// AppID 申请应用后快手返回的 app_id
AppID uint64 `json:"app_id,omitempty"`
// PageNo 分页页码,必填
PageNo int `json:"page_no,omitempty"`
// PageSize 分页每页展示条数,必填,最大值为1000
Expand Down
4 changes: 2 additions & 2 deletions model/oauth/refresh_token_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import "encoding/json"

// RefreshTokenRequest 刷新Token APIRequest
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"`
// AppID 应用ID
AppID uint64 `json:"app_id,omitempty"`
}

// Url implement PostRequest interface
Expand Down
8 changes: 4 additions & 4 deletions model/oauth/url_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ import (

// UrlRequest 生成授权链接APIRequest
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"`
// Scope 授权scope
Scope []string `json:"scope,omitempty"`
// AppID 应用ID
AppID uint64 `json:"app_id,omitempty"`
}

// Encode implement GetRequest interface
Expand Down

0 comments on commit 80f93a8

Please sign in to comment.