Supabase is a great tool. But currently lacks the ability to natively use a Web3 Provider to authenticate. This guide aims to provide a walkthrough so you’ll be able to issue JSON web tokens to users who sign-in with their Ethereum Wallet.
What you’ll need:
-
Supabase account
-
JWTKey andServiceKey
-
- Supabase
public.userstable - A Client able to interact with Wallet Provider
- ethers.js and MetaMask
-
Serverless Function Endpoints:
/api/nonce /api/login /api/write
This walkthrough assumes your user has already connected their wallet. If you need help with that, check out the ethers.js documentation.
So, once they’ve connected, the first thing we’ll do behind the scenes in our client app code is make a POST request to the /api/nonce endpoint. In it, we’ll include the just-connected wallet address.
Supabase public.users Table
Before we can get into the code, we’ll need to set up a new table in our Supabase project. It’s…