I’m upgrading all packages from v7.3.0 to v9.7.0
In v7 the modal login was working flawlessly with this configuration:
await web3auth.initModal({
modalConfig: {
openlogin: {
label: "openlogin",
loginMethods: {
google: {
name: "google",
mainOption: true,
},
facebook: {
name: "facebook",
mainOption: true,
},
email_passwordless: {
name: "email_passwordless",
showOnModal: false,
},
phone_passwordless: {
name: "phone_passwordless",
showOnModal: false,
},
...
},
},
Since v9.7.0 it looks like openlogin is no longer working.
I’m trying to replicate the react-modal-playground demo found https://pnp-modal-playground.vercel.app/
but I don’t understand how I’m supposed to initialize my modal since I don’t use the context and those react hooks.
I’m getting the following error:
Uncaught (in promise) WalletInitializationError: Invalid params passed in, Invalid wallet connect project id. Please configure it on the dashboard
at WalletInitializationError.fromCode (index.js:73:12)
at WalletInitializationError.invalidParams (index.js:108:38)
at eval (modalManager.js:256:567)
at Array.map ()
at Web3Auth.initModal (modalManager.js:106:54)
at async Object.initWeb3Auth
And this is the code I’m using:
const clientId = process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID!;
const chainId = process.env.NEXT_PUBLIC_IS_DEVELOPMENT ? 0x13882 : 0x89; // Mumbai or Polygon Mainnet
const chainConfig = getEvmChainConfig(chainId, clientId)!;
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: { chainConfig },
});
const web3AuthOptions: Web3AuthOptions = {
clientId,
web3AuthNetwork: process.env.NEXT_PUBLIC_IS_DEVELOPMENT
? 'sapphire_devnet'
: 'sapphire_mainnet',
privateKeyProvider,
};
const authAdapter = new AuthAdapter({
loginSettings: {
mfaLevel: MFA_LEVELS.OPTIONAL,
},
adapterSettings: {
uxMode: "redirect"
},
});
const walletServicesPlugin = new WalletServicesPlugin({
wsEmbedOpts: {},
walletInitOptions: {
whiteLabel: { showWidgetButton: true, buttonPosition: BUTTON_POSITION.BOTTOM_RIGHT },
confirmationStrategy: CONFIRMATION_STRATEGY.MODAL,
},
});
web3auth = new Web3Auth(web3AuthOptions);
// Configure default adapters
const adapters = getDefaultExternalAdapters({ options: web3AuthOptions });
[...adapters, authAdapter].forEach((adapter: IAdapter<unknown>) => {
web3auth.configureAdapter(adapter);
});
web3auth.addPlugin(walletServicesPlugin);
await web3auth.initModal({
modalConfig: {
openlogin: {
label: "openlogin",
loginMethods: {
google: {
name: "google",
mainOption: true,
},
facebook: {
name: "facebook",
mainOption: true,
},
email_passwordless: {
name: "email_passwordless",
showOnModal: false,
},
phone_passwordless: {
name: "phone_passwordless",
showOnModal: false,
},
twitter: {
name: "twitter",
showOnModal: false,
},
reddit: {
name: "reddit",
showOnModal: false,
},
discord: {
name: "discord",
showOnModal: false,
},
twitch: {
name: "twitch",
showOnModal: false,
},
apple: {
name: "apple",
showOnModal: false,
},
line: {
name: "line",
showOnModal: false,
},
github: {
name: "github",
showOnModal: false,
},
kakao: {
name: "kakao",
showOnModal: false,
},
linkedin: {
name: "linkedin",
showOnModal: false,
},
weibo: {
name: "weibo",
showOnModal: false,
},
wechat: {
name: "wechat",
showOnModal: false,
},
},
showOnModal: true,
},
},
});
- SDK Version(package.json):9.7.0
- Platform: NextJS
Also, kindly provide the Web3Auth initialization and login code snippet below. This will help us better understand your issue and provide you with the necessary assistance.