Sign in with Ethereum
Authenticate users with your backend securely by proving they own a given Ethereum address.
SIWE (Sign-In with Ethereum) allows anyone to integrate passwordless web3-native authentication and authorization into their applications. Users can then login using any wallet (in-app, external, or smart wallet).
This allows developers to create a familiar, secure authentication flow that works with traditional backends while leveraging the features of a web3 application.
Try out SIWE auth for yourself in the auth live playground
In your backend, configure the auth object with the createAuth
function.
The createAuth
helper returns an object with all the functions you will need to authenticate users. Check out the createAuth API reference for more details.
Your backend can use those functions to expose a SIWE compliant login flow to your frontend.
Here's an example using server actions and a JWT for session management:
You can then add a SIWE step to the connection flow of the ConnectWallet
or ConnectEmbed
UI component by configuring the auth
option. This will automatically trigger the wallet to sign the login payload returned by getLoginPayload
and trigger the doLogin
function you implemented in your backend.
You can use the signLoginPayload
function to trigger the signing of the login payload yourself. This can be useful if you want to use a custom UI for the login flow. You can get the active account that will sign the payload from the useActiveAccount
hook.