File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Thirdweb/Thirdweb.Wallets/InAppWallet/EcosystemWallet Expand file tree Collapse file tree 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()
312312 return JsonConvert . DeserializeObject < EcosystemDetails > ( content ) ;
313313 }
314314
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+
315330 #endregion
316331
317332 #region Account Linking
You can’t perform that action at this time.
0 commit comments