WalletLoginError: Failed to connect with wallet. Failed to login with openlogin #1329
bolisteward
announced in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I'm developing a little project with web3auth using jwt with firebase and I have problems with the login, please I need your help.
I got error WalletLoginError: Failed to connect with wallet. Failed to login with openlogin.
I thought that it could happened by the jwt configuration in the dashboard but it is ok.
`
export function Web3Auth({ children, web3Network, chain }: IWeb3AuthProps) {
const [web3Auth, setWeb3Auth] = useState<Web3AuthCore | null>(null);
const [firebaseApp, setfirebaseApp] = useState<FirebaseApp | undefined>(undefined);
const [user, setUser] = useState<unknown | null>(null);
const [provider, setProvider] = useState<IWalletProvider | null>(null);
const [isLoading, setIsLoading] = useState(false);
const setWalletProvider = useCallback(
(web3authProvider: SafeEventEmitterProvider) => {
const walletProvider = getWalletProvider(chain, web3authProvider);
setProvider(walletProvider);
},
[chain]
);
useEffect(() => {
}, [chain, setWalletProvider, setWalletProvider]);
const signInWithGoogle = async (): Promise => {
try {
const auth = getAuth(firebaseApp);
const googleProvider = new GoogleAuthProvider();
const res = await signInWithPopup(auth, googleProvider);
return res;
}
const signInWithFacebook = async (): Promise => {
try {
}
const signInWithTwitter = async (): Promise => {
try {
}
async function login(TypeLogin: LOGIN_PROVIDER_TYPE, email?: string, password?: string) {
try {
setIsLoading(true);
if (!web3Auth) {
console.log("web3auth not initialized yet");
return;
}
}
const loginWithWalletConnect = async () => {
try {
setIsLoading(true);
if (!web3Auth) {
console.log("web3auth not initialized yet");
return;
}
const localProvider = await web3Auth.connectTo(WALLET_ADAPTERS.WALLET_CONNECT_V1, {});
setWalletProvider(localProvider!);
} catch (error) {
console.log("error", error);
} finally {
setIsLoading(false)
}
};
const loginWithMetamask = async () => {
try {
setIsLoading(true);
if (!web3Auth) {
console.log("web3auth not initialized yet");
return;
}
console.log("web3auth initialized");
const localProvider = await web3Auth.connectTo(WALLET_ADAPTERS.METAMASK, {});
setWalletProvider(localProvider!);
} catch (error) {
console.log("error", error);
} finally {
setIsLoading(false)
}
};
const logout = async () => {
if (!web3Auth) {
console.log("web3auth not initialized yet");
return;
}
await web3Auth.logout();
setProvider(null);
};
const getUserInfo = async () => {
if (!web3Auth) {
console.log("web3auth not initialized yet");
return;
}
const user = await web3Auth.getUserInfo();
console.log(user);
};
const getAccounts = async () => {
if (!provider) {
console.log("provider not initialized yet");
return;
}
provider.getAccounts();
};
const getBalance = async () => {
if (!provider) {
console.log("provider not initialized yet");
return;
}
provider.getBalance();
};
const signMessage = async () => {
if (!provider) {
console.log("provider not initialized yet");
return;
}
provider.signMessage();
};
//init();
const contextProvider = {
web3Auth,
provider,
user,
isLoading,
login,
loginWithWalletConnect,
loginWithMetamask,
logout,
getUserInfo,
getAccounts,
getBalance,
signMessage,
};
return (
<>
)
}`
Beta Was this translation helpful? Give feedback.
All reactions