REST API Integration
Authenticate a user and fetch their wallets.
This guide helps developers integrate Clique Wallet into their applications using the RESTful API.
Prerequisites
Access to a Clique Wallet instance
The Clique Wallet API endpoint URL
A web application or backend service where you want to integrate Clique Wallet
Basic understanding of REST APIs and HTTP requests
Basic Setup
1. Configure Your Clique Wallet Endpoint
First, configure your application to point to your Clique Wallet instance:
const WALLET_API_URL = 'https://your-wallet-instance.com';2. Understand the Authentication Flow
Clique Wallet uses session-based authentication for user-facing applications. When a user successfully authenticates, Clique Wallet sets a secure HTTP-only session cookie that maintains the user's authentication state.
Your First Integration
Step 1: User Authentication
Users can authenticate using various methods. Here's a simple example using email verification:
Request a Verification Code:
Complete Login:
After the user receives and enters the verification code:
Upon successful login, Clique Wallet will:
Create wallets for all supported blockchains (if they don't exist)
Set a secure session cookie
Return user information including wallet addresses
Step 2: Check Session Status
To verify the user is authenticated and get their wallet information:
The response will include:
User ID
Wallet addresses for all supported networks (Solana, EVM-compatible chains, etc.)
Authentication methods bound to the account
Step 3: Get Wallet Addresses
Wallet addresses are automatically created upon first login. You can retrieve them from the session response:
Step 4: Sign Your First Transaction
To sign a transaction, send the transaction data to the sign endpoint:
The response will include the signature that can be used to submit the transaction to the blockchain.
Authentication Methods
Clique Wallet supports multiple authentication methods:
Social OAuth (Google, X/Twitter, Telegram):
Initialize OAuth flow with
/oauth/initRedirect user to the OAuth provider
Handle callback at
/oauth/callbackComplete login with
/loginusing the OAuth credentials
External Wallet Connection:
Get challenge message from
/challengeUser signs the challenge with their external wallet
Complete login with
/loginusing the signature
Phone Verification: Similar to email verification, but use phone instead of email in the request.
Common Patterns
Checking if User is Logged In:
Handling Session Expiration:
Error Handling:
Last updated