File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
packages/thirdweb/src/wallets/connection Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " thirdweb " : patch
3+ ---
4+
5+ Auto-login on autoconnect of IAW in all cases
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import type {
88 AuthArgsType ,
99 AuthStoredTokenWithCookieReturnType ,
1010} from "../in-app/core/authentication/types.js" ;
11+ import { isInAppSigner } from "../in-app/core/wallet/is-in-app-signer.js" ;
1112import { getUrlToken } from "../in-app/web/lib/get-url-token.js" ;
1213import type { Wallet } from "../interfaces/wallet.js" ;
1314import {
@@ -192,7 +193,20 @@ const _autoConnectCore = async ({
192193 }
193194
194195 // Auto-login with SIWE
195- if ( urlToken && activeWallet && props . siweAuth ?. requiresAuth ) {
196+ const isIAW =
197+ activeWallet &&
198+ isInAppSigner ( {
199+ wallet : activeWallet ,
200+ connectedWallets : activeWallet
201+ ? [ activeWallet , ...otherWallets ]
202+ : otherWallets ,
203+ } ) ;
204+ if (
205+ isIAW &&
206+ props . siweAuth ?. requiresAuth &&
207+ ! props . siweAuth ?. isLoggedIn &&
208+ ! props . siweAuth ?. isLoggingIn
209+ ) {
196210 await props . siweAuth ?. doLogin ( ) ;
197211 }
198212 manager . isAutoConnecting . setValue ( false ) ;
Original file line number Diff line number Diff line change @@ -125,5 +125,7 @@ export type AutoConnectProps = {
125125 siweAuth ?: {
126126 requiresAuth : boolean ;
127127 doLogin : ( ) => Promise < void > ;
128+ isLoggedIn : boolean | undefined ;
129+ isLoggingIn : boolean | undefined ;
128130 } ;
129131} ;
You can’t perform that action at this time.
0 commit comments