Skip to content

Commit 12ea553

Browse files
authored
Add TikTok as AuthProvider (#154)
1 parent 6080fbe commit 12ea553

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

Thirdweb.Console/Program.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
#pragma warning disable IDE0005
22
#pragma warning disable IDE0059
33

4+
using System.Diagnostics;
45
using dotenv.net;
6+
using Newtonsoft.Json;
57
using Thirdweb;
68

79
DotEnv.Load();
@@ -14,8 +16,8 @@
1416

1517
#region Basic Wallet Interaction
1618

17-
// // Create a private key wallet
18-
// var privateKeyWallet = await PrivateKeyWallet.Generate(client);
19+
// Create a private key wallet
20+
var privateKeyWallet = await PrivateKeyWallet.Generate(client);
1921

2022
// var walletAddress = await privateKeyWallet.GetAddress();
2123
// Console.WriteLine($"PK Wallet address: {walletAddress}");
@@ -744,7 +746,7 @@
744746

745747
#region InAppWallet - OAuth
746748

747-
// var inAppWalletOAuth = await InAppWallet.Create(client: client, authProvider: AuthProvider.Github);
749+
// var inAppWalletOAuth = await InAppWallet.Create(client: client, authProvider: AuthProvider.TikTok);
748750
// if (!await inAppWalletOAuth.IsConnected())
749751
// {
750752
// _ = await inAppWalletOAuth.LoginWithOauth(

Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet/EcosystemWallet.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ public static async Task<EcosystemWallet> Create(
137137
Thirdweb.AuthProvider.Line => "Line",
138138
Thirdweb.AuthProvider.Guest => "Guest",
139139
Thirdweb.AuthProvider.X => "X",
140+
Thirdweb.AuthProvider.TikTok => "TikTok",
140141
Thirdweb.AuthProvider.Coinbase => "Coinbase",
141142
Thirdweb.AuthProvider.Github => "Github",
142143
Thirdweb.AuthProvider.Twitch => "Twitch",
@@ -744,6 +745,7 @@ public async Task<List<LinkedAccount>> LinkAccount(
744745
case "Telegram":
745746
case "Line":
746747
case "X":
748+
case "TikTok":
747749
case "Coinbase":
748750
case "Github":
749751
case "Twitch":
@@ -871,7 +873,7 @@ public async Task<string> LoginWithOtp(string otp)
871873
var platform = this.HttpClient?.Headers?["x-sdk-name"] == "UnitySDK_WebGL" ? "web" : "dotnet";
872874
var redirectUrl = isMobile ? mobileRedirectScheme : "http://localhost:8789/";
873875
var loginUrl = await this.EmbeddedWallet.FetchHeadlessOauthLoginLinkAsync(this.AuthProvider, platform).ConfigureAwait(false);
874-
loginUrl = platform == "web" ? loginUrl : $"{loginUrl}&redirectUrl={redirectUrl}&developerClientId={this.Client.ClientId}&authOption={this.AuthProvider}";
876+
loginUrl = platform == "web" ? loginUrl : $"{loginUrl}&redirectUrl={redirectUrl}&developerClientId={this.Client.ClientId}&authOption={this.AuthProvider.ToLower()}";
875877
if (!string.IsNullOrEmpty(this._ecosystemId))
876878
{
877879
loginUrl = $"{loginUrl}&ecosystemId={this._ecosystemId}";

Thirdweb/Thirdweb.Wallets/InAppWallet/EmbeddedWallet.Authentication/Server.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ internal override async Task<VerifyResult> VerifyGuestAsync(string sessionId)
200200
// login/oauthprovider
201201
internal override Task<string> FetchHeadlessOauthLoginLinkAsync(string authProvider, string platform)
202202
{
203-
return Task.FromResult(MakeUri2024($"/login/{authProvider}", new Dictionary<string, string> { { "clientId", this._clientId }, { "platform", platform } }).ToString());
203+
return Task.FromResult(MakeUri2024($"/login/{authProvider.ToLower()}", new Dictionary<string, string> { { "clientId", this._clientId }, { "platform", platform } }).ToString());
204204
}
205205

206206
// login/email

Thirdweb/Thirdweb.Wallets/InAppWallet/InAppWallet.Types.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public enum AuthProvider
2020
Line,
2121
Guest,
2222
X,
23+
TikTok,
2324
Coinbase,
2425
Github,
2526
Twitch,

0 commit comments

Comments
 (0)