Perhaps this is my error, but I’m seeing on the web3auth dashboard that each time I execute a login for the same user with a refreshed Firebase JWT, the wallet count sometimes increasesby one. Sometimes it does not.
So I assume that either:
- I have missed a step to maintain association with specific wallet
- There is a bug
I am using @web3auth/mpc-core-kit version 1.1.3, Chrome browser, running locally using Hardhat. Using Hardhat worked fine for no-modal SDK.
Here is the code:
// The environment file contains all correct values previously used
// successfully with the no-modal SDK
// I have enabled Core SDK on the dashboard for the project
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: toHex(1337),
rpcTarget: environment.rpcUrl,
displayName: 'Hardhat',
blockExplorer: environment.explorerUrls.explorerUrl,
ticker: 'XDC',
tickerName: 'XDC Network',
decimals: 18,
};
const coreKitInstance = new Web3AuthMPCCoreKit({
web3AuthClientId: environment.wallet.web3Auth.clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.DEVNET,
uxMode: 'redirect',
baseUrl: window.location.href,
enableLogging: true,
chainConfig,
storageKey: 'local',
});
await coreKitInstance.init();
// refresh the Firebase JWT and fetch the value of the 'sub' field
const idToken = await user.getIdTokenResult(true);
const verifierId = idToken.claims.sub;
console.log('verifierId', verifierId);
if (!isString(verifierId)) {
throw new Error('verifierId is not a string');
}
await coreKitInstance.loginWithJWT({
idToken: idToken.token,
verifier: environment.wallet.web3Auth.verifierName,
verifierId,
});
I have used the custom verifier successfully with the no-modal SDK, and now I am migrating to MPC. I am pretty sure the verification of the Firebase JWT is ok.
I am refreshing the JWT directly before attempting web3auth authentication.
My questions are:
- Why is a new account created some times when I run this code and sometimes not created? (I refreshed web3auth dashboard stats each time, sometimes it went up, sometimes not)
- Did I miss a step, if so what must I do?
- I do not get a
provider
in the value returned fromloginwithJWT()
- I get void. This doesn’t match the docs - how can I get provider? - Will you add some documentation for MPC that demonstrates all the steps for specific scenarios? It is hard to understand what code must be performed, which code is optional. The React examples are a bit helpful but they don’t describe “why” something is being done.
Thanks for the help.