Authentication
Wallet-based authentication using the SDK — nonce, sign, verify, JWT.
Authentication
Recur uses wallet-based authentication. The subscriber signs a nonce message to prove wallet ownership and receives a JWT for authenticated API calls.
authenticate (high-level)
One call handles the full flow: request nonce → sign message → verify → return JWT.
The wallet must implement RecurWallet:
Standard Solana wallet adapters satisfy this interface.
Manual flow
If you need more control (e.g., caching nonces, custom error handling):
1. Request nonce
2. Sign message
3. Verify and get JWT
Using the JWT
Pass the token in the Authorization header for authenticated endpoints:
Refreshing tokens
Error handling
authenticate throws AuthError if the nonce request fails, the wallet rejects signing, or verification fails. It throws WalletRejectedError specifically if the user declines the sign prompt.