Example of await web3auth.authenticateUser() in the React Demo

Hi, I'm trying to implement Server Side Verification when using an external wallet like Metamask. https://web3auth.io/docs/server-side-verification/external-wallets

I'm trying to get the Id Token by calling this: await web3auth.authenticateUser()

But I don't see how to do that in the React App repo. https://github.com/Web3Auth/Web3Auth/tree/master/demo/react-app

I am however seeing it within the Vue Demo: https://github.com/Web3Auth/Web3Auth/blob/71aae19acb9bc6e01c57c106edd311efb9250bcb/demo/vue-app/src/chains/ethereum.vue#L209-L212

Is there a React example of calling authenticateUser when using the IWeb3AuthContext?



Originally posted by: adaro

Check the discussion at: https://github.com/orgs/Web3Auth/discussions/508

this demo is not updated yet, but you can simply add a new function in services/web3auth.tsx file as shown below:

const authenticateUser = async () => {
if (!web3Auth) {
console.log("web3auth not initialized yet");
uiConsole("web3auth not initialized yet");
return;
}
await web3Auth. authenticateUser();
};



Originally posted by: himanshuchawla009