Skip to content

Commit cf3e13f

Browse files
committed
fixes logout in node sdk
1 parent b6a35ee commit cf3e13f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Web3Auth.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class Web3Auth extends SafeEventEmitter<Web3AuthSfaEvents> implements IWe
102102
}
103103

104104
get connected(): boolean {
105-
return Boolean(this.sessionManager?.sessionId);
105+
return this.status === ADAPTER_STATUS.CONNECTED;
106106
}
107107

108108
get provider(): IProvider | null {
@@ -356,11 +356,12 @@ export class Web3Auth extends SafeEventEmitter<Web3AuthSfaEvents> implements IWe
356356

357357
async logout(): Promise<void> {
358358
if (!this.connected) throw WalletLoginError.notConnectedError("Not logged in");
359-
const sessionId = this.currentStorage.get<string>("sessionId");
360-
if (!sessionId) throw WalletLoginError.fromCode(5000, "User not logged in");
361359

362-
await this.sessionManager.invalidateSession();
363-
this.currentStorage.set("sessionId", "");
360+
if (this.coreOptions.mode !== SDK_MODE.NODE) {
361+
await this.sessionManager.invalidateSession();
362+
this.currentStorage.set("sessionId", "");
363+
}
364+
364365
this.updateState({
365366
privKey: "",
366367
userInfo: {

0 commit comments

Comments
 (0)