Redirect page code outdated and doesn't work

Code noted here no longer works https://web3auth.io/docs/sdk/core-kit/tkey/intrinsic-flow#redirect-page

privateKey does not exist on result. Please advise which key to use here. In addition I needed to update .directWeb to .customAuthInstance

const init = async () => {
  // Initialization of Service Provider
  try {
    // Init is required for Redirect Flow but skip fetching sw.js and redirect.html )
    (tKey.serviceProvider as any).init({ skipInit: true });
    if (
      window.location.pathname === "/auth" &&
      window.location.hash.includes("#state")
    ) {
      let result = await (
        tKey.serviceProvider as any
      ).customAuthInstance.getRedirectResult();
      tKey.serviceProvider.postboxKey = new BN(
        // This is undefined
        (result.result as any).privateKey!,
        "hex"
      );
    
    }
  } catch (error) {
    console.error(error);
  }
};

Found updated code here that works https://github.com/Web3Auth/web3auth-core-kit-examples/blob/main/tkey-web/intrinsic-flow-examples/tkey-redirect-flow-example/src/App.tsx

Thanks for reporting this.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.