Using Google Social Login with Web3Auth
Please find the code below
const web3auth = new Web3Auth({
clientId: WEB_3_AUTH_CLIENT_ID,
chainConfig: {
chainId: numberToHex(CHAIN_ID),
chainNamespace: "eip155",
},
uiConfig: {
dark: true,
},
web3AuthNetwork: web3AuthNetwork[CHAIN_ID],
});
const openloginAdapter = new OpenloginAdapter({
adapterSettings: {
uxMode: "popup",
loginConfig: {
// Google login
google: {
verifier: "krida", // Pass the Verifier name here
typeOfLogin: "google", // Pass on the login provider of the verifier you've created
clientId:
"332104705818-uu2v2dln75q*******",
},
},
},
});
web3auth.configureAdapter(openloginAdapter);
await web3auth.initModal();
const socialProvider = await web3auth.connect();
const web3Instance = new Web3(socialProvider);
const accounts = await web3Instance.eth.getAccounts();
Not getting accounts, instead getting an error
Provider does not have a request or send method to use.
Here is the package.json
"@ethersproject/providers": "^5.6.1",
"@ethersproject/units": "^5.6.0",
"@loadable/component": "^5.15.2",
"@web3-react/core": "^8.0.22-beta.0",
"@web3-react/injected-connector": "^6.0.7",
"@web3-react/metamask": "^8.0.0-beta.0",
"@web3auth/base": "^6.1.3",
"@web3auth/modal": "^6.1.3",
"@web3auth/openlogin-adapter": "^7.2.0",
"@web3modal/ethereum": "^2.7.1",
"@web3modal/react": "^2.6.0",
"assert": "^2.0.0",
"axios": "^0.26.1",
"body-scroll-lock": "^4.0.0-beta.0",
"buffer": "^6.0.3",
"classnames": "^2.3.1",
"crypto-browserify": "^3.12.0",
"dotenv": "^16.0.3",
"ethers": "^5.7.2",
"https-browserify": "^1.0.0",
"intro.js": "4.1.0",
"intro.js-react": "0.4.0",
"os-browserify": "^0.3.0",
"process": "^0.11.10",
"react": "^18.0.2",
"stream-browserify": "^3.0.0",
"stream-http": "^3.2.0",
"url": "^0.11.0",
"viem": "^1.1.8",
"wagmi": "^1.3.1",
"web-vitals": "^2.1.4",
"web3": "1.5.0"
},
Here is the error screenshot