The code is as it is in youtube tutorial of Moralis. I am getting this error because of getMoralisAuth(). Also I have tried to import it from β@moralisweb3/client-firebase-authβ and @moralisweb3/client-firebase-auth-utils, still not working.
import { useState } from "react";
import { initializeApp } from "firebase/app";
import { getMoralisAuth } from "@moralisweb3/client-firebase-auth-utils";
// import { getMoralisAuth } from "@moralisweb3/client-firebase-auth";
import { signInWithMoralis } from "@moralisweb3/client-firebase-evm-auth";
import { getAuth } from "@firebase/auth";
const firebaseConfig = {
//confidentials
};
const app = initializeApp(firebaseConfig);
const moralisAuth = getMoralisAuth(app);
const auth = getAuth(app);
function App() {
const [user, setUser] = useState(null);
async function login() {
const res = await signInWithMoralis(moralisAuth);
setUser(res.credentials.user.uid);
}
async function logout() {
await auth.signOut();
setUser(null);
}
return (
<div className="App">
<header className="App-header">
<p>Firebase Moralis Auth Extension π</p>
{!user ? (
<div style={{ cursor: "pointer" }} onClick={login}>
Login
</div>
) : (
<>
<p>User:{user}</p>
<div style={{ cursor: "pointer" }} onClick={logout}>
Logout
</div>
</>
)}
</header>
</div>
);
}
export default App;