Hi I am trying the MPC Core kit sdk, I noticed there is not much info how I can initialize web3auth with other network (e.g., polygon) as I want. I only found tutorial for Plug n Play. so it import from web3auth/modal , there is no such in the mpc-core-kit module.
I only see options const selectedNetwork = WEB3AUTH_NETWORK.DEVNET; to choose the network, which limited us to the default sapphire dev or mainnet…
thanks for the help, any clue or code example will be very helpful.
okay, after a couple of hours working, I think I figured out how to set things up. but faces some CORS issue where I am not sure if I can easily fix it myself…
first of all. the solution:
this is how to config it:
const coreKitInstance = new Web3AuthMPCCoreKit(
{
web3AuthClientId: 'your clientId, get it from your web3auth dashboard',
// commeted as awe are going to
// use custom chainConfig
//web3AuthNetwork:selectedNetwork,
// set up polygon network
chainConfig: {
chainNamespace: "eip155",
chainId: "0x13881", // hex of 137, polygon mainnet
rpcTarget: "your rpc node url",
// Avoid using public rpcTarget in production.
// Use services like Infura, Quicknode etc
displayName: "Polygon Mumbai Testnet",
blockExplorer: "https://mumbai.polygonscan.com/",
ticker: "MATIC",
tickerName: "Matic",
}
}
);
Access to fetch at ‘https://sapphire-5.auth.network/sss/jrpc’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
which leads to the login failure: login error Error: Error occurred while verifying params verifier mobifi-firebase-tkey-w3a not found for account id: (I have to remove the account id)
thanks, I tried to deploy the app to a server so it comes with https, but it’s still blocked by your CORS policy.
Access to fetch at ‘https://sapphire-5.auth.network/sss/jrpc’ from origin ‘https://mpc-core-kit-react-firebase-example.vercel.app’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
index.ts:96
POST https://sapphire-5.auth.network/sss/jrpc net::ERR_FAILED