1
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package tiktok
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
)
|
||||
|
||||
@@ -42,31 +41,8 @@ type TiktokOauthResone struct {
|
||||
}
|
||||
}
|
||||
|
||||
// 获取抖音token
|
||||
func (a *API) GetTiktokToken(code string) (*OauthAccessTokenRes, error) {
|
||||
tokenReq := make(map[string]interface{}, 4)
|
||||
tokenReq["client_secret"] = a.clientSecret
|
||||
tokenReq["code"] = code
|
||||
tokenReq["grant_type"] = "authorization_code"
|
||||
tokenReq["client_key"] = a.clientKey
|
||||
|
||||
result, err := a.AccessAPI2(BaseURL, tokenReq)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
oauthAccessToken := &OauthAccessTokenRes{}
|
||||
if err := utils.Map2StructByJson(result, oauthAccessToken, false); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if oauthAccessToken.Data.ErrorCode != 0 {
|
||||
return nil, errors.New(oauthAccessToken.Data.Description)
|
||||
}
|
||||
return oauthAccessToken, nil
|
||||
}
|
||||
|
||||
// 获取抖音登录授权2
|
||||
func (a *API) GetTiktokToken2(code string) (*TiktokOauthResone, error) {
|
||||
func (a *API) GetTiktokOauth(code string) (*TiktokOauthResone, error) {
|
||||
tokenReq := make(map[string]interface{}, 3)
|
||||
tokenReq["appid"] = a.GetAppID()
|
||||
tokenReq["code"] = code
|
||||
|
||||
Reference in New Issue
Block a user