This Code runs well on my Local Server but once I build and upload it to my Live sever The await authenticate()
function doesn’t seem to work anymore. Am I missing something?
const { authenticate, isWeb3Enabled ,isAuthenticated, isAuthenticating, user, enableWeb3, Moralis, logout } = useMoralis();
const [currentAccount, setCurrentAccount] = useState();
const [balance, setBalance] = useState(0);
const login = async () => {
if (!isAuthenticated) {
await authenticate({provider: "metamask" })
.then(function (user) {
console.log("logged in user:", user);
console.log(user.get("ethAddress"));
setCurrentAccount(user.get("ethAddress"))
})
.catch(function (error) {
console.log(error);
});
}
}
const logOut = async () => {
await logout();
console.log("logged out");
}```