Authentication
Learn how to authenticate with the DotPassport API using API keys.
Overview
All API requests require authentication via an API key. The SDK handles authentication automatically once you provide your key during initialization.
Getting an API Key
Step 1: Create an Account
Sign up for a developer account
Verify your email address
Step 2: Generate API Key
Navigate to the API Keys section in your dashboard
Click Generate New Key
Choose your key type (Test or Live)
Copy your API key immediately (it won't be shown again)
Important: Store your API key securely. Never expose it in client-side code or commit it to version control.
API Key Types
Test Keys (test_*)
test_*)For development and testing
Access to sandbox data only
No production data access
Unlimited for development
Live Keys (live_*)
live_*)For production use
Access to real user data
Rate limits apply based on tier
Requires verified account
Using API Keys
Environment Variables (Recommended)
Store your API key in environment variables:
Then use it in your code:
Configuration Files
For Node.js applications, use a config file:
Framework-Specific Setup
Next.js
Vite
Create React App
Security Best Practices
DO ✅
Store API keys in environment variables
Use server-side API calls when possible
Rotate keys regularly
Use different keys for development and production
Restrict API key permissions
Monitor API key usage
DON'T ❌
Commit API keys to version control
Expose keys in client-side JavaScript (for sensitive operations)
Share keys between environments
Use production keys in development
Hardcode keys in source code
Log API keys
Key Permissions
Configure what your API keys can access:
Read Only
Fetch user data only
Public widgets, display-only apps
Read/Write
Fetch and update data
Admin dashboards, management tools
Full Access
All API operations
Server-side applications
Rotating API Keys
Regularly rotate your API keys for security:
Generate a new API key
Update your environment variables
Deploy the changes
Verify the new key works
Revoke the old key
Troubleshooting
Invalid API Key (401)
Problem: Getting "Invalid API key" error
Solutions:
Verify the key is correctly copied (no extra spaces)
Check the key starts with
live_ortest_Ensure the key hasn't been revoked
Verify environment variables are loaded
Missing API Key
Problem: Getting "Missing API key" error
Solutions:
Check environment variable is set
Verify the variable name matches your code
Restart your development server
Check
.envfile is in the correct location
Permission Denied (403)
Problem: API key doesn't have required permissions
Solutions:
Check key permissions in dashboard
Generate a new key with correct permissions
Use a different key for this operation
Next Steps
Quick Start Guide - Start using the SDK
API Client Methods - Explore available methods
Rate Limiting - Understand rate limits
Last updated
