@@ -8,6 +8,7 @@ import type {
8
8
AuthArgsType ,
9
9
AuthStoredTokenWithCookieReturnType ,
10
10
} from "../in-app/core/authentication/types.js" ;
11
+ import { isInAppSigner } from "../in-app/core/wallet/is-in-app-signer.js" ;
11
12
import { getUrlToken } from "../in-app/web/lib/get-url-token.js" ;
12
13
import type { Wallet } from "../interfaces/wallet.js" ;
13
14
import {
@@ -92,9 +93,9 @@ const _autoConnectCore = async ({
92
93
clientId : props . client . clientId ,
93
94
ecosystem : isEcosystemWallet ( wallet )
94
95
? {
95
- id : wallet . id ,
96
- partnerId : wallet . getConfig ( ) ?. partnerId ,
97
- }
96
+ id : wallet . id ,
97
+ partnerId : wallet . getConfig ( ) ?. partnerId ,
98
+ }
98
99
: undefined ,
99
100
} ) ;
100
101
await clientStorage . saveAuthCookie ( urlToken . authCookie ) ;
@@ -150,9 +151,9 @@ const _autoConnectCore = async ({
150
151
const connectedWallet = await ( connectOverride
151
152
? connectOverride ( activeWallet )
152
153
: manager . connect ( activeWallet , {
153
- client : props . client ,
154
- accountAbstraction : props . accountAbstraction ,
155
- } ) ) ;
154
+ client : props . client ,
155
+ accountAbstraction : props . accountAbstraction ,
156
+ } ) ) ;
156
157
if ( connectedWallet ) {
157
158
autoConnected = true ;
158
159
try {
@@ -192,7 +193,20 @@ const _autoConnectCore = async ({
192
193
}
193
194
194
195
// 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
+ ) {
196
210
await props . siweAuth ?. doLogin ( ) ;
197
211
}
198
212
manager . isAutoConnecting . setValue ( false ) ;
0 commit comments