Skip to main content

Prerequisites

Before implementing authentication, ensure you have:
  • App Registration: Your app must be registered with Dialect (registration guide)
  • Client Key: Your Dialect client key (format: dk_...)

Authentication Overview

Dialect uses a two-part authentication system for inbox integration:
  1. Client Key (X-Dialect-Client-Key): Identifies your application
  2. JWT Token (Authorization: Bearer): Authenticates the user via wallet signature
The authentication flow involves:
  1. Prepare: Generate a message/transaction for the user to sign
  2. Sign: User signs with their wallet
  3. Verify: Exchange the signature for a JWT token
  4. Use: Include the JWT token in subsequent API calls

Flow diagram

Code examples

Step 1: Prepare Authentication

Request a message for the user to sign:

Step 2: Sign Message

Have the user sign the message with their wallet:

Step 3: Verify & Get JWT

Exchange the signature for a JWT token:

Making Authenticated Requests

You’ve setup the authentication flow. From now on, you can send requests to the API. Include both headers in all subsequent API calls:

Token Lifetime

JWT tokens issued through the authentication flow have a 1 year lifetime. After this period, users will need to re-authenticate by signing a new message to obtain a fresh token.