Working example
Privy sign-in
Sign in once, connect the wallet you want to use, and watch the selection arrive without replacing this page.
Nothing on this page asks you to approve a transaction or sign a message.
Account
- Status
- Signed out
- Account
- Sign in
- Active wallet
- No wallet selected
Signing in and having a wallet ready to send are two separate steps. Sign out in the header clears the wallet shown here.
Setup
- In your Privy dashboard, choose how people sign in, give every new account a wallet, and add your site's exact web address to the allowed list.
-
Give your copy of the site its Privy app ID and verification key, named
PRIVY_APP_IDandPRIVY_VERIFICATION_KEY. Keep the Privy app secret off the page people load. -
Create your database, then prepare sign-in with the command
mix ash_template.setup_local_auth. -
Start the site with the commands
mix assets.buildandmix phx.server, then open this page.
Parts
- The sign-in button in the header, the same on every page.
- One small script that hears every sign-in button press and keeps the page and the site in step.
- The Privy connection: signing in, choosing a wallet and signing out.
- This page's wallet readout, which only watches and never signs anyone in.
- The site's own record of who is signed in. A wallet address in the browser never proves who you are.
The look comes from Regent's shared design kit, and the sign-in check comes from a shared Regent library. The Privy connection shown here belongs to this site.
Privy's guide to signing out