Docs
Using API Keys in C# / Unity
Using API Keys in C# / Unity
How to use the Euler Stream API keys in the C# / Unity library.
Prerequisites
- You have signed up for an Euler Stream account.
- You have created an API key in the Euler Stream dashboard.
- You have installed the
TikTokLiveSharp
library.
How to Use
To use the Euler Stream API keys in the C# / Unity library, you need to set the API key config in the ClientSettings
struct.
Here's an example hello-world script demonstrating this:
using TikTokLiveSharp.Client;
using TikTokLiveSharp.Client.Config;
using TikTokLiveSharp.Events;
namespace TikTokLiveSharpWPFTestApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
TikTokLiveClient client = new TikTokLiveClient(inputHostId.Text, "", new ClientSettings()
{
SigningKey = "YOUR_API_KEY"
});
client.OnJoin += Client_OnJoin;
client.Run(new System.Threading.CancellationToken());
}
private static void Client_OnJoin(TikTokLiveClient sender, Join e)
{
SetConsoleColor(ConsoleColor.Green);
Console.WriteLine($"{e.User.UniqueId} joined!");
SetConsoleColor(ConsoleColor.White);
}
}
}