I’m following the tutorial to set up a web application. Everything works fine when using the config from the examples. However, when changing my development project, the UI always asks me to install Metamask Extention. But it is installed and working with the example.
Here is my config:
const clientId = process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID!;
const chainConfig = {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0xaa36a7',
rpcTarget: 'https://rpc.ankr.com/eth_sepolia',
displayName: 'Ethereum Sepolia Testnet',
blockExplorerUrl: 'https://sepolia.etherscan.io',
ticker: 'ETH',
tickerName: 'Ethereum',
logo: 'https://cryptologos.cc/logos/ethereum-eth-logo.png',
};
const privateKeyProvider = new EthereumPrivateKeyProvider({
config: {
chainConfig,
},
});
const web3AuthOptions: Web3AuthOptions = {
chainConfig,
clientId,
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
privateKeyProvider,
};
const adapters = getDefaultExternalAdapters({ options: web3AuthOptions });
const web3AuthContextConfig = {
web3AuthOptions,
adapters: [...adapters],
};
export default web3AuthContextConfig;
The NEXT_PUBLIC_WEB3AUTH_CLIENT_ID
is set correctly. I’m seeing the successful configuration call in the network tab:
{
"network": "sapphire_devnet",
"sms_otp_enabled": true,
"wallet_connect_enabled": true,
"key_export_enabled": true,
"whitelist": {
"urls": [
"http://localhost:3000"
],
"signed_urls": {
"http://localhost:3000": "MEQCIGR0koD2Y97UKcUAklbQPsCtcqAEl_ojKyVZslh4PLUeAiBrk5oPlEnGXxcSo0Dn6VpEdAAQdVzpkF9mCwTjvh-CFQ"
}
}
}
But when clicking connect, I’m getting this:
And on Metamask (or any other wallet):
When using the CLIENT_ID
from the example:
NEXT_PUBLIC_WEB3AUTH_CLIENT_ID="BPi5PB_UiIZ-cPz1GtV5i1I2iOSOHuimiXBI0e-Oe_u6X3oVAbCiAZOTEBtTXw4tsluTITPqA8zMsfxIKMjiqNQ"
and WEB3AUTH_NETWORK.SAPPHIRE_MAINNET
:
const web3AuthOptions: Web3AuthOptions = {
...
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_MAINNET,
...
};
Everything works. So, I assume something is wrong with my application config, but I haven’t figured out why. Any hint how I could further debug would be very much appreciated