WalletInitializationError: Invalid params passed in, provider should have chainConfig and should be intiliazed with chainId and chainNamespace

WalletLoginError: Custom. User has already enabled mfa, please use the @web3auth/web3auth-web sdk for login with mfa
at Function.fromCode (/home/ec2-user/Web3-FanTv/node_modules/@web3auth/base/dist/base.cjs.js:416:12)
at Web3Auth. (/home/ec2-user/Web3-FanTv/node_modules/@web3auth/node-sdk/dist/Web3Auth.js:58:47)
at Generator.next ()
at fulfilled (/home/ec2-user/Web3-FanTv/node_modules/@web3auth/node-sdk/dist/Web3Auth.js:5:58)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
code: 5000
}

I am using custom Provider , along with Node Sdk, @web3auth/node-sdk ( after 1000+ logins now it is throwing error ) :-> Tried switching to “@web3auth/single-factor-auth” unable to connect

it throws error : WalletInitializationError: Invalid params passed in, provider should have chainConfig and should be intiliazed with chainId and chainNamespace

const { Web3Auth } = require(“@web3auth/single-factor-auth”);

const { EthereumPrivateKeyProvider } = require(“@web3auth/ethereum-provider”);

const provider = new EthereumPrivateKeyProvider({
config: {
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: “0x13881”, // Chain ID for Mumbai testnet
rpcTarget: “https://rpc-mumbai.maticvigil.com”, // Mumbai testnet RPC endpoint
displayName: “Polygon Mumbai Testnet”, // Display name for the network
blockExplorer: “https://mumbai.polygonscan.com/”, // Mumbai testnet block explorer
ticker: “MATIC”, // Ticker symbol for the testnet token
tickerName: “MATIC”, // Ticker name for the testnet token
},
},
});

const web3auth = new Web3Auth({
clientId: process.env.WEB3_AUTH_CLIENT_ID, // Get your Client ID from Web3Auth Dashboard
web3AuthNetwork: “testnet”, // Available networks are “testnet”, “mainnet”, “cyan”, “aqua”.
usePnPKey: false, // Setting this to true returns the same key as PnP Web SDK, By default, this SDK returns CoreKitKey.
enableLogging:true
});

web3auth.init({ provider });

1 Like

@jaswant.kumar Welcome Aboard!

The NodeJS SDK is the part of our Single Factor Auth SDKs which is further a part of our Core Kit Product. It is meant for usage with a Single Factor, ie. only the social login share to reconstruct the key.

If you’re using this SDK alongside our plug and play SDKs, there will be issues when the user enables MFA. This is because the other factor is not present in the backend node environment, it only has the capability of constructing keys with one share. Our frontend SDKs only have the capability to use MFA factors and reconstruct keys.

If you’re already in production with the SDK, unfortunately, there is no way to turn off MFA. You need to construct their keys in the frontend only. Further, please use our MFA Settings Multi Factor Authentication with PnP Web Modal SDK | Documentation | Web3Auth
to make sure you turn off MFA for your users.

How can we disable Multi-factor-Auth , when using custom JWT verifier . Because none of the user enabled the mfa, I am using following packages

const { Web3Auth }= require(“@web3auth/node-sdk”);
const { EthereumPrivateKeyProvider } =require(“@web3auth/ethereum-provider”);

//Initialize within your constructor
const web3auth = new Web3Auth({
clientId: process.env.WEB3_AUTH_CLIENT_ID, // Get your Client ID from Web3Auth Dashboard
web3AuthNetwork: “testnet”, // Available networks are “testnet”, “mainnet”, “cyan”, “aqua”.
usePnPKey: false, // Setting this to true returns the same key as PnP Web SDK.
});

const chainConfig={
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: “0x13881”, // Chain ID for Mumbai testnet
rpcTarget: “https://rpc-mumbai.maticvigil.com”, // Mumbai testnet RPC endpoint
};

const provider = new EthereumPrivateKeyProvider({ config: { chainConfig } })

await web3auth.connect({
verifier: “cutoms-jwt-verifier”,
verifierId: userId,
idToken: userWeb3AuthToken
});

We are not enabling mfa at any level . Can you just check if I need to change any settings.

@jaswant.kumar Hi, I see two different errors. In the first part of it, I see an error where it says that the user has enabled MFA. SFA SDKs work only for users who have not enabled MFA. Check out the warning here.

But none of the user has enabled the MFA, How come it automatically got enabled .
We haven’t done any kind of frontend integration yet where users gets to enable the MFA.

Hey @jaswant.kumar,
This depends on if your dapp uses the built-in login methods or uses custom verifiers.
If you use custom verifiers, your users and mfa levels are scoped to your app. If not, they’ll be global and shared with all default users of web3auth sdk.
If your users have enabled mfa with the built-in login methods of the web3auth sdk, then they will face this error.
If you still have questions around this, plan on joining our Community Call, we’ll have engineers who will take your doubts.

I am facing the same issue can anyone help me with this?