Authentication

Relay44 supports three authentication methods. All produce a JWT access token for subsequent API calls.

SIWE (Sign-In with Ethereum)

The standard flow for EVM wallets. Request a nonce, construct a SIWE message, sign it with the wallet, and submit the signature.

bash
# 1. Get nonce\ncurl https://relay44.com/v1/auth/siwe/nonce
bash
# 2. Login with signed message
curl -X POST https://relay44.com/v1/auth/siwe/login \
  -H 'Content-Type: application/json' \
  -d '{"message": "<siwe-message>", "signature": "<0x-signature>"}'

Solana

Same nonce-sign-verify flow but for Solana wallets. The signature uses the wallet's ed25519 key pair.

bash
curl -X POST https://relay44.com/v1/auth/solana/login \
  -H 'Content-Type: application/json' \
  -d '{"message": "<nonce>", "signature": "<base58-signature>", "pubkey": "<base58-pubkey>"}'

Farcaster

Authenticate using your Farcaster custody address. Relay44 verifies through Neynar.

bash
curl -X POST https://relay44.com/v1/auth/farcaster/login \
  -H 'Content-Type: application/json' \
  -d '{"message": "<nonce>", "signature": "<custody-sig>", "fid": 12345}'

JWT lifecycle

On successful login, you receive an access_token (short-lived) and a refresh_token (long-lived). Include the access token in all authenticated requests. When it expires, use the refresh endpoint to get a new one.

bash
# Use access token
curl -H 'Authorization: Bearer <access_token>' \
  https://relay44.com/v1/positions
bash
# Refresh expired token
curl -X POST https://relay44.com/v1/auth/refresh \
  -H 'Content-Type: application/json' \
  -d '{"refresh_token": "<refresh_token>"}'