Social Login using Etherspot SDK
Demonstrate how social login work with Etherspot SDK
npm install --save @web3auth/modalyarn add @web3auth/modalimport { Web3AuthCore } from '@web3auth/core'
const web3AuthInstance = new Web3AuthCore({
clientId: web3AuthClientId, // created in the Web3Auth Dashboard as described above
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0x1', // ChainID in hexadecimal
},
storageKey: 'local',
})const openLoginAdapter = new OpenloginAdapter({
adapterSettings: {
network: 'mainnet',
clientId: web3AuthClientId,
},
loginSettings: {
mfaLevel: 'none',
},
})
web3AuthInstance.configureAdapter(openLoginAdapter)
// Listen to events emitted by the Web3Auth Adapter
web3AuthInstance.on(ADAPTER_EVENTS.CONNECTED, () => {
if (!web3AuthInstance?.provider) {
return
}
})
web3AuthInstance.on(ADAPTER_EVENTS.ERRORED, (error) => {
console.log(error)
})
// Initialise the web3Auth instance after setting up the Adapter Configuration
await web3AuthInstance.init()Last updated
Was this helpful?