fudiwei / DotNetCore.SKIT.FlurlHttpClient.ByteDance

可能是全网唯一的 C# 版字节跳动 SDK,封装全部已知的字节跳动 OpenAPI,包含字节小程序开放平台、抖音开放平台、抖店开放平台、巨量引擎开放平台、TikTok Developer API、TikTok Shop Open Platform 等模块,可跨平台,持续随官方更新。欢迎 Star/Fork/PR。QQ 交流群 875580418【满】、930461548【满】、611974621。
https://github.com/fudiwei/DotNetCore.SKIT.FlurlHttpClient
MIT License
241 stars 59 forks source link

不能和抖音一起用?(To be compatible with the global version of Tiktok) #7

Closed xuanvuong1702 closed 2 years ago

xuanvuong1702 commented 2 years ago

image

我没有看到 tiktok.com

fudiwei commented 2 years ago

https://open.douyin.com/platform/doc?doc=docs/openapi/account-permission/douyin-get-permission-code

xuanvuong1702 commented 2 years ago

https://open.douyin.com/platform/doc?doc=docs/openapi/account-permission/douyin-get-permission-code

Sorry, Can I talk english with you? I mean, Can i use this library for Tiktok (tiktok.com), global version of Douyin

fudiwei commented 2 years ago

This SDK is designed to access the Douyin Open Platform API (also includes some other ByteDance's products).

I'm not sure if Tiktok has open platform API like Douyin.

If you have an official documentation, please post it.

xuanvuong1702 commented 2 years ago

This SDK is designed to access the Douyin Open Platform API (also includes some other ByteDance's products).

I'm not sure if Tiktok has open platform API like Douyin.

If you have an official documentation, please post it.

This is official doc of Tiktok global: https://developers.tiktok.com/doc/overview/

fudiwei commented 2 years ago

Thank you very much.

It looks like the API models of requests and responses are basically the same. But I still need to take a moment to check whether just adding a new endpoint is enough. If not, I will create a new package to handle this.

xuanvuong1702 commented 2 years ago

w package to han

Thanks you very much.

fudiwei commented 2 years ago

Sorry for making you wait on this reply. I hope you weren’t waiting for too long.

I created a new package SKIT.FlurlHttpClient.ByteDance.TikTokGlobal to handle this.

Because I don't have a TikTok developer account for testing, so I'm not sure it will work well. I'd like to get some feedback from you.

Unfortunately, I don't have much free time to add much documentation, especially the non-Chinese version. I'm posting sample code which should give you enough idea on how to use it.

using SKIT.FlurlHttpClient.ByteDance.TikTokGlobal;
using SKIT.FlurlHttpClient.ByteDance.TikTokGlobal.Models;

var options = new TikTokClientOptions()
{
    ClientKey = "Your Client Key",
    ClientSecret = "Your Client Secret"
};
var client = new TikTokClient(options);

var request = new OAuthAccessTokenRequest()
{
    Code = "Your Code"
};
var response = await client.ExecuteOAuthAccessTokenAsync(request);
if (response.IsSuccessful())
{
    Console.WriteLine("AccessToken: " + response.Data.AccessToken);
}
else
{
    Console.WriteLine("ErrorCode: " + response.Data?.ErrorCode);
}

You can continue to leave a message here if you have more questions.

xuanvuong1702 commented 2 years ago

Thanks so much. I will test it and feed back.