Firebase signup/login via web3

Viewed 215

Instead of using the normal firebase authentication methods I want to use web3 (specifically metamask) to provide signup/login without the need of email and passwords. The problem is, how do I handle signups?

One way I thought of doing it would be to use the users wallet address as the email and just add my domain as the @ part for example: 0x0000000000000000000000000000000000000000@example.com but then the problem is how do I add a password for firebase to use?

Is there anyway to authenticate using metamask?

1 Answers

I wish I had seen this question earlier, We have developed a mechanism just for this requires a server that runs the firebase-admin that mints a custom token and pass it to the client and signs in with signInWithCustomToken.

The code is here https://github.com/novum-insights/sveltekit-unlock-firebase.

This is a boilerplate that uses sveltekit and paywalls the user with unlock-protocol.

Related