Skip to content

Commit 98eda9d

Browse files
gregfromstlclaude
andauthored
Fix: Auto-signin to autoconnect for all cases (#7011)
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 5a13ad4 commit 98eda9d

File tree

3 files changed

+22
-1
lines changed

3 files changed

+22
-1
lines changed

.changeset/little-cities-help.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"thirdweb": patch
3+
---
4+
5+
Auto-login on autoconnect of IAW in all cases

packages/thirdweb/src/wallets/connection/autoConnectCore.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff 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";
1112
import { getUrlToken } from "../in-app/web/lib/get-url-token.js";
1213
import type { Wallet } from "../interfaces/wallet.js";
1314
import {
@@ -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);

packages/thirdweb/src/wallets/connection/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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
};

0 commit comments

Comments
 (0)