Provider empty

Hello, I have the following code:

  private configAdapters() {
    const openLoginAdapter = new OpenloginAdapter({
      adapterSettings: {
        network: 'testnet',
        uxMode: 'popup',
        clientId: 'myclient',
        loginConfig: {
          jwt: {
            name: 'fake-name',
            verifier: 'laprop-testnet-5',
            typeOfLogin: 'jwt',
            clientId: 'myclient'
          }
        }
      }
    });
    return {
      openLoginAdapter
    };
  };
  private getWeb3AuthCore() {
    const clientId = 'myclient';
    const web3auth = new Web3AuthCore({
      clientId,
      chainConfig: { // this is ethereum chain config, change if other chain(Solana, Polygon)
        chainNamespace: CHAIN_NAMESPACES.EIP155,
        rpcTarget: 'https://data-seed-prebsc-1-s1.binance.org:8545/',
        blockExplorer: 'https://bscscann.com'
      }
    });
    const { openLoginAdapter } = this.configAdapters();
    web3auth.configureAdapter(openLoginAdapter);
    return web3auth;
  }
private async initWeb3Core(token) {
      try {
        await this.web3Auth.init();
        console.log('init');
        const session = await this.web3Auth.connectTo(
          WALLET_ADAPTERS.OPENLOGIN, {
            loginProvider: 'jwt',
            extraLoginOptions: {
              id_token: token
              domain: 'http://localhost:3000',
              verifierIdField: 'sub'
            }
          });
        console.log('printing session');
        console.log(session);
      } catch (e) {
        console.log('having error');
        console.log(e);
        throw e;
      }
  }

After I logged in and the popup was successful, everythings works as expected. The problem is now when I refresh. Because the information is on the session storage, it fails when I try to use connectTo . To avoid that I am using something like this:

private async initWeb3Core(token) {
      try {
        await this.web3Auth.init();
        console.log('init');
        if(web3Auth.status !== "connected"){
        const session = await this.web3Auth.connectTo(
          WALLET_ADAPTERS.OPENLOGIN, {
            loginProvider: 'jwt',
            extraLoginOptions: {
              id_token: token
              domain: 'http://localhost:3000',
              verifierIdField: 'sub'
            }
          });
          }
        console.log('printing session');
        console.log(this.web3Auth.provider)
        console.log(session);
      } catch (e) {
        console.log('having error');
        console.log(e);
        throw e;
      }
  }

Now when I refresh and I try to print the provider, it is empty. It only returns a empty proxy.



Originally posted by: irux

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/658