Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 1.41 KB

README.md

File metadata and controls

29 lines (22 loc) · 1.41 KB

Web3 auth frontend example

Complete example of web3 authentication example

🤖 Demo

Live demo App deployed on Vercel

Backend

Checkout the backend code here, deployed in Heroku

Why signing message to authenticate users?

You want to verify that the user owns certain address, so the backend will provide a message and the user sign it. The user use their private key to sign the message. To validate the signature you use some maths along with the message, and you should get the public key which in turns give you the address, cryptographically you can't get the validation from the message to be equal to the public key without the private key thus proving ownership.

You can understand more here

How is the working flow?

  1. User connect account
  2. Server send a message with a token to the user
  3. User sign the message, and send back the to the server the signing message with the token
  4. Server first validate if the message it's legit using the token, and then validate the signature of the message.
  5. if the signature it's valid, server send back to the user a session token
  6. User navigates in private routes using session token

Libraries used

  • ethers
  • JWT
  • Tailwindcss