Skip to content

Commit

Permalink
added OAuth2Config
Browse files Browse the repository at this point in the history
Allan-Nava authored Jul 26, 2024
1 parent 298dde4 commit d6fba2c
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/api_content_test.go
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ import (
"testing"
)

func Test(t *testing.T) {
func TestCreatorInfo(t *testing.T) {
c, err := GetTikTok()
if err != nil {
t.Fatalf(err.Error())
13 changes: 12 additions & 1 deletion tiktok/tiktok.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
package tiktok

import "github.com/go-resty/resty/v2"
import (
"github.com/go-resty/resty/v2"
"golang.org/x/oauth2"
)

type ITiktok interface {
//
HealthCheck() error
IsDebug() bool
CodeAuthUrl()
CreatorInfo() (*QueryCreatorInfoResponse, error)
PostVideoInit(title, videoUrl string, privacyLevel string) (*PublishVideoResponse, error)
PublishVideo(publishId string) (*PublishStatusFetchResponse, error)
@@ -18,6 +22,7 @@ type tiktok struct {
clientKey string
clientSecret string
accessToken string
OAuth2Config *oauth2.Config
}

func NewTikTok(clientKey, clientSecret string, isDebug bool) (ITiktok, error) {
@@ -26,6 +31,12 @@ func NewTikTok(clientKey, clientSecret string, isDebug bool) (ITiktok, error) {
clientSecret: clientSecret,
restClient: resty.New(),
debug: isDebug,
OAuth2Config: &oauth2.Config{
ClientID: clientKey,
ClientSecret: clientSecret,
RedirectURL: "",
Scopes: []string{"email"},
Endpoint: Endpoint,
}

Check failure on line 40 in tiktok/tiktok.go

GitHub Actions / build (1.19.x)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 40 in tiktok/tiktok.go

GitHub Actions / build (1.20.x)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 40 in tiktok/tiktok.go

GitHub Actions / build (1.20.x)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 40 in tiktok/tiktok.go

GitHub Actions / build (1.21.x)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 40 in tiktok/tiktok.go

GitHub Actions / build (1.21.x)

syntax error: unexpected newline in composite literal; possibly missing comma or }

Check failure on line 40 in tiktok/tiktok.go

GitHub Actions / build (1.22.x)

syntax error: unexpected newline in composite literal; possibly missing comma or }
o.restClient.SetDebug(isDebug)

Check failure on line 41 in tiktok/tiktok.go

GitHub Actions / build (1.19.x)

syntax error: unexpected ) at end of statement

Check failure on line 41 in tiktok/tiktok.go

GitHub Actions / build (1.20.x)

syntax error: unexpected ) at end of statement

Check failure on line 41 in tiktok/tiktok.go

GitHub Actions / build (1.20.x)

syntax error: unexpected ) at end of statement

Check failure on line 41 in tiktok/tiktok.go

GitHub Actions / build (1.21.x)

syntax error: unexpected ) at end of statement

Check failure on line 41 in tiktok/tiktok.go

GitHub Actions / build (1.21.x)

syntax error: unexpected ) at end of statement

Check failure on line 41 in tiktok/tiktok.go

GitHub Actions / build (1.22.x)

syntax error: unexpected ) at end of statement
o.restClient.SetBaseURL(BASE_URL)

0 comments on commit d6fba2c

Please sign in to comment.