How to connect web3 frontend to web2 backend

Viewed 98

I am wondering with all the web3 tutorials out there, the wallet like Metamask always gets connected to the frontend (FE) through different libraries.

What is the approach if there should still be a web2 backend (BE) with a database?

So if I connect from Metamask to the FE, how can the BE trust this verification coming from the FE? Does the verification process then have to go through the BE and no longer the FE meaning we have to introduce some message signing? How is this done?

Is this already implemented in reasonable manner e.g. with a node BE?

Concretely, I am using wagmi authentication on the FE and connect to the FE through the injected Metamask provider. Now the express BE should store user data of the logged-in user (wallet addresses, tokens available, investments done, etc.).

But this interaction between FE and BE can have a middle-man attack, no? So I can't trust the FE request, how can I combine FE and BE authentication still using wagmi but am safe on the BE side? On the same time, I don't want to have 2 authentication processes for FE and also BE which would impact the user experience.

0 Answers
Related