Skip to content

Commit

Permalink
Fix logout
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1995 committed Sep 26, 2023
1 parent b583bf6 commit 9a4b0d8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
6 changes: 3 additions & 3 deletions examples/vue-example/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default defineComponent({
privKey: "",
ethereumPrivateKeyProvider: null as EthereumPrivateKeyProvider | EthMpcPrivKeyProvider | null,
LOGIN_PROVIDER: LOGIN_PROVIDER,
selectedLoginProvider: LOGIN_PROVIDER.GOOGLE as LOGIN_PROVIDER_TYPE,
selectedLoginProvider: LOGIN_PROVIDER.EMAIL_PASSWORDLESS as LOGIN_PROVIDER_TYPE,
login_hint: "",
isWhiteLabelEnabled: false,
UX_MODE: UX_MODE,
Expand All @@ -152,7 +152,7 @@ export default defineComponent({
BUILD_ENV: BUILD_ENV,
selectedOpenloginNetwork: OPENLOGIN_NETWORK.SAPPHIRE_DEVNET as OPENLOGIN_NETWORK_TYPE,
useMpc: true,
selectedBuildEnv: BUILD_ENV.PRODUCTION,
selectedBuildEnv: BUILD_ENV.DEVELOPMENT
};
},
async created() {
Expand Down Expand Up @@ -240,7 +240,7 @@ export default defineComponent({
console.log(openLoginObj, "OPENLOGIN");
const data = await this.openloginInstance.login(openLoginObj);
if (data.privKey) {
if (data && data.privKey) {
this.privKey = data.privKey;
await this.setProvider(this.privKey);
}
Expand Down
11 changes: 9 additions & 2 deletions packages/openlogin/src/OpenLogin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class OpenLogin {
}
}

async login(params: LoginParams & Partial<BaseRedirectParams>): Promise<{ privKey: string }> {
async login(params: LoginParams & Partial<BaseRedirectParams>): Promise<{ privKey: string } | null> {
if (!params.loginProvider) throw LoginError.invalidLoginParams(`loginProvider is required`);

// in case of redirect mode, redirect url will be dapp specified
Expand All @@ -191,7 +191,7 @@ class OpenLogin {
};

const result = await this.openloginHandler(`${this.baseUrl}/start`, dataObject, getTimeout(params.loginProvider));
if (this.options.uxMode === UX_MODE.REDIRECT) return undefined;
if (this.options.uxMode === UX_MODE.REDIRECT) return null;
if (result.error) {
this.dappState = result.state;
throw LoginError.loginFailed(result.error);
Expand Down Expand Up @@ -232,6 +232,13 @@ class OpenLogin {
isMfaEnabled: false,
},
authToken: "",
sessionId: "",
factorKey: "",
signatures: [],
tssShareIndex: -1,
tssPubKey: "",
tssShare: "",
tssNonce: -1,
});

this.currentStorage.set("sessionId", "");
Expand Down

0 comments on commit 9a4b0d8

Please sign in to comment.