Archived Content from Web3Auth Community
This topic was originally posted by studiokanvas on 8/23/2023.
This content has been migrated from our previous community forum to preserve valuable discussions.
Please provide the following details too when asking for help in this category:
- SDK Version: N/A
- Platform: iPhone/Mobile
- Browser Console Screenshots: N/A
Please provide the Web3Auth initialization and login code snippet below:
I have tried both No Modal and Modal versions. They all fail to do anything on web browsers on mobile (iPhone, have not tested Android yet).
The modal/noModal works fine on a desktop browser ie Chrome, but it doesn’t work on mobile.
This is in my react.js application:
const chainConfig = { chainNamespace: CHAIN_NAMESPACES.EIP155, chainId: "0x1", rpcTarget: "https://rpc.ankr.com/eth", // This is the public RPC we have added, please pass on your own endpoint while creating an app displayName: "Ethereum Mainnet", blockExplorer: "https://etherscan.io", ticker: "ETH", tickerName: "Ethereum", }const metamaskAdapter = new MetamaskAdapter({ clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID, // Get your Client ID from Web3Auth Dashboard sessionTime: 3600, // 1 hour in seconds web3AuthNetwork: "cyan", chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155, chainId: "0x1", rpcTarget: "https://rpc.ankr.com/eth", // This is the public RPC we have added, please pass on your own endpoint while creating an app }, }) const web3Auth = new Web3AuthNoModal({ clientId: process.env.NEXT_PUBLIC_WEB3AUTH_CLIENT_ID, // Get your Client ID from Web3Auth Dashboard chainConfig, }) const privateKeyProvider = new EthereumPrivateKeyProvider({ config: { chainConfig } }) const openloginProvider = new OpenloginAdapter({ privateKeyProvider, }) web3Auth.configureAdapter(openloginProvider) web3Auth.configureAdapter(metamaskAdapter) metamaskAdapter.setAdapterSettings({ sessionTime: 86400, // 1 day in seconds chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155, chainId: "0x1", rpcTarget: "https://rpc.ankr.com/eth", // This is the public RPC we have added, please pass on your own endpoint while creating an app }, web3AuthNetwork: "cyan", }) web3Auth.init().then( (response) => console.log("response: ", response), (error) => console.log(error) ) const loginGoogle = async () => { const response = await web3Auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, { loginProvider: "google", }) console.log("response: ", response) } const loginApple = async () => { const response = await web3Auth.connectTo(WALLET_ADAPTERS.OPENLOGIN, { loginProvider: "apple", }) console.log("response: ", response) } const loginMetaMask = async () => { const response = await web3Auth.connectTo(WALLET_ADAPTERS.METAMASK) console.log("response: ", response) }