File tree 1 file changed +15
-0
lines changed
Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -312,6 +312,21 @@ public async Task<EcosystemDetails> GetEcosystemDetails()
312
312
return JsonConvert . DeserializeObject < EcosystemDetails > ( content ) ;
313
313
}
314
314
315
+ public string GenerateExternalLoginLink ( string redirectUrl )
316
+ {
317
+ var authProvider = HttpUtility . UrlEncode ( this . AuthProvider . ToLower ( ) ) ;
318
+ var walletId = this . GetType ( ) . Name . Contains ( "InAppWallet" ) ? "inApp" : this . _ecosystemId ;
319
+ var authCookie = HttpUtility . UrlEncode ( this . EmbeddedWallet . GetSessionData ( ) ? . AuthToken ?? "" ) ;
320
+
321
+ if ( string . IsNullOrEmpty ( authCookie ) )
322
+ {
323
+ throw new InvalidOperationException ( "Cannot generate external login link without an active session." ) ;
324
+ }
325
+
326
+ var queryString = redirectUrl . Contains ( '?' ) ? "&" : "?" + $ "walletId={ walletId } &authProvider={ authProvider } &authCookie={ authCookie } ";
327
+ return $ "{ redirectUrl } { queryString } ";
328
+ }
329
+
315
330
#endregion
316
331
317
332
#region Account Linking
You can’t perform that action at this time.
0 commit comments