Sign In With Ethereum

Sign in with an Ethereum wallet message.

This page documents the current Ruby port behavior. Ruby uses snake_case option names and auth.api method names; HTTP paths and JSON keys keep the upstream wire shape where implemented.

Configure

config/auth.rb
require "better_auth"

auth = BetterAuth.auth(
  secret: ENV.fetch("BETTER_AUTH_SECRET"),
  base_url: ENV.fetch("BETTER_AUTH_URL", "http://localhost:3000"),
  plugins: [
    BetterAuth::Plugins.siwe(domain: "localhost")
  ]
)

Usage

server.rb
nonce = auth.api.get_siwe_nonce(
  body: { address: "0xabc123..." }
)

result = auth.api.verify_siwe_message(
  body: {
    message: signed_message,
    signature: signature
  }
)

Routes

MethodPathRuby API method
POST/siwe/nonceauth.api.get_siwe_nonce
POST/siwe/verifyauth.api.verify_siwe_message

Options

Current Ruby options accepted by BetterAuth::Plugins.siwe:

  • get_nonce
  • anonymous
  • verify_message
  • domain
  • email_domain_name
  • ens_lookup

Support Notes

  • The examples above are based on Ruby plugin source and tests in packages/better_auth.
  • If an upstream section is not represented here, treat it as not yet documented or not yet supported by the Ruby port until the matching Ruby implementation exists.

On this page