diff --git a/packages/service-provider-torus/src/TorusServiceProvider.ts b/packages/service-provider-torus/src/TorusServiceProvider.ts index 6abe82e0..e94d42b9 100644 --- a/packages/service-provider-torus/src/TorusServiceProvider.ts +++ b/packages/service-provider-torus/src/TorusServiceProvider.ts @@ -44,6 +44,9 @@ class TorusServiceProvider extends ServiceProviderBase { async triggerLogin(params: SubVerifierDetails): Promise { const obj = await this.customAuthInstance.triggerLogin(params); + // incase of redirectflow which return null + if (!obj) return; + const localPrivKey = Torus.getPostboxKey(obj); this.postboxKey = new BN(localPrivKey, "hex"); return obj; @@ -51,6 +54,9 @@ class TorusServiceProvider extends ServiceProviderBase { async triggerAggregateLogin(params: AggregateLoginParams): Promise { const obj = await this.customAuthInstance.triggerAggregateLogin(params); + // incase of redirectflow which return null + if (!obj) return; + const localPrivKey = Torus.getPostboxKey(obj); this.postboxKey = new BN(localPrivKey, "hex"); return obj;