Hi
So I’m trying to authenticate the user using Sequence wallet via Wallet connect.
I am using web3uikit’s ConnectButton to help me use WalletConnect to connect to Sequence wallet.
This is my index.js file (the necessary imports have been made)
ReactDOM.render(
<React.StrictMode>
<MoralisProvider
appId=process.env.APP_ID
serverUrl=process.env.SERVER_URL
initializeOnMount={false}
>
<NotificationProvider>
<BrowserRouter>
<App />
</BrowserRouter>
</NotificationProvider>
</MoralisProvider>
</React.StrictMode>,
document.getElementById("root")
);
And in my app.js
file
function App(){
const { isAuthenticated, Moralis, user, authenticate } =
useMoralis();
useEffect(() => {
const isAuth = () =>
!isAuthenticated
? authenticate({ provider: "walletconnect" })
.then((user) => log(user))
.catch((e) => log(e))
: null;
isInitialized && isAuth();
}, [isInitialized, isAuthenticated]);
return (
<>
{log("isAuthenticated", isAuthenticated)}
{isAuthenticated ? (
// redirect to user dashboard
) : (
<div>
<h1>Please connect wallet to continue</h1>
<ConnectButton moralisAuth={false} />
</div>
)}
</>
);
}
I have used the same approach before but with Metamask, and it seems to turn isAuthenticated
to true after signing in.
But now the issue is that even if I login, the web3uikit’s ConnectButton
displays my account name and money, but it still keeps isAuthenticated
to false