API
Authentication
Set up wallet-based user authentication for notification inbox integration using JWT tokens and client keys
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:
- Client Key (
X-Dialect-Client-Key
): Identifies your application - JWT Token (
Authorization: Bearer
): Authenticates the user via wallet signature
The authentication flow involves:
- Prepare: Generate a message/transaction for the user to sign
- Sign: User signs with their wallet
- Verify: Exchange the signature for a JWT token
- 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: