i am recieving Error: Error occurred while verifying paramssubVerifierParams need to equal threshold 1

web3auth.ts


import { Web3Auth } from '@web3auth/node-sdk';
import { CHAIN_NAMESPACES, SafeEventEmitterProvider } from '@web3auth/base';
import { WEB3AUTH } from '../config/globals';
import logger from '../config/logger';

export const web3auth = new Web3Auth({
  clientId: WEB3AUTH.clientId,
  chainConfig: {
    chainNamespace: CHAIN_NAMESPACES.EIP155,
    chainId: WEB3AUTH.chainId,
    rpcTarget: WEB3AUTH.rpcTarget,
    displayName: 'Polygon Mainnet',
    blockExplorer: 'https://polygonscan.com',
    ticker: 'MATIC',
    tickerName: 'Matic',
  },
  web3AuthNetwork: process.env.NODE_ENV === 'production' ? 'mainnet' : 'testnet',
});

export const connect = async (token: string): Promise<void> => {
  try {
    const provider = (await web3auth.connect({
      verifier: WEB3AUTH.verifier, // replace with your verifier name
      verifierId: WEB3AUTH.verifierId, // replace with your verifier id, setup while creating the verifier on Web3Auth's Dashboard
      idToken: token, // replace with your newly created unused JWT Token.
      subVerifierInfoArray: [
        {
          verifier: 'ga-google',
          idToken: token,
        },
        {
          verifier: 'zt-email',
          idToken: token,
        },
      ],
    })) as SafeEventEmitterProvider;
    if (!provider) logger.error('error');
    const ethPrivKey = await provider.request({ method: 'eth_private_key' });
    logger.info('ETH Private Key', ethPrivKey);
  } catch (error) {
    throw error;
  }
};

controller.ts

web3authHandler = asyncHandler(async (req: Request, res: Response, next: NextFunction) => {
    try {
      web3auth.init();
      const accessToken: string = res.locals.accessToken;
      const data = await connect(accessToken);
      console.log('data: ', data);
      return new SuccessResponse('Successful web3auth', { data }).send(res);
    } catch (error) {
      throw error;
    }
  });

What should i do now? I am completely stuck here. Also provide me with more insights of web3auth. What should I use as the verifier and verifierId?

0

There are 0 answers