I’m facing an issue on Safari for social login/email login, below the code:
useEffect(() => {
const initWeb3Auth = async () => {
const web3AuthInstance = new Web3Auth({
web3AuthNetwork: WEB3AUTH_NETWORK.SAPPHIRE_DEVNET,
clientId:
'BGIxxxxxxx....xxxxxxx1k', // Get your Client ID from the Web3Auth Dashboard
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: '0x61',
rpcTarget:
'https://xxxx.....xxxxxx3/',
},
modalZIndex: '99998',
});
setWeb3Auth(web3AuthInstance);
await web3AuthInstance.initModal();
setProvider(web3AuthInstance.provider);
};
initWeb3Auth();
}, []);
const login = async () => {
try {
console.log('Attempting to login...');
const connectResponse = await web3auth.connect();
const user = await web3auth.getUserInfo();
setProvider(web3auth.provider);
const rpc = new RPC(web3auth.provider);
const address = await rpc.getAccounts();
setUser({
...user,
address: address,
});
setLoggedIn(true);
} catch (error) {
console.error('Login failed:', error);
}
};
It is showing “verify your google” and then disappears, i can’t see errors cause i’m on mobile. Works fine on browser.
vjgee
November 28, 2023, 2:46pm
2
@pietro.ciattaglia Thanks for your recent post.
Are you able to login on other browsers like Google Chrome? If so, you may refer to the below steps for Safari:
Open Settings
.
Open the Safari
section.
Under the Privacy
heading, make sure to uncheck Prevent Cross-Site Tracking
4.Under the General
section, ensure the toggle next to Block Pop-ups
is disabled
Please find the steps to get the browser console logs on iOS if you still face any issues:
We are here to assist you if you encounter any difficulties when using Web3Auth on an iOS device. Please refer to the steps for debugging and sharing console errors with us to resolve the issue.
Debugging in Safari on iOS
On your Mac, open Safari, then go to Safari > Settings.
Click Advanced and click Show Develop menu in menu bar / Show features for web developers at the bottom of the window. Close the window.
On your iPad or iPhone or iOS Simulator, go to Settings > Safari > Advanced.
Press …
Ok on chrome mobile it is working, on safari by doing the steps you said is working too. The only problem is that in production i cannot say to all users to do these things, how can i solve?
vjgee
November 28, 2023, 3:18pm
4
Thanks for confirming.
MacOS / iOS blocks Popups by default unless the steps I provided are done by the user on their browser. Web3Auth modal allows you to use redirect mode.
you can set it using uxMode: 'redirect'
instead of pop-up mode.
Please refer to the documentation above and if you need, here is the example using the same.
system
Closed
November 30, 2023, 3:19pm
5
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.