New: Unified API Platform - 250+ Endpoints, One Integration, Infinite PossibilitiesExplore Now ?
Back to Guides

Authentication Guide

Learn how to authenticate with the OnlyOneAPI platform securely

API Key Authentication

Primary authentication method

API keys are the primary method of authentication for OnlyOneAPI. Each key is unique to your account and should be kept secure.

Getting Your API Key

  1. Log in to your OnlyOneAPI dashboard
  2. Navigate to API Keys section
  3. Click"Generate New Key"
  4. Copy your key immediately (it won't be shown again)

Using Your API Key

// Include your API key in the Authorization header
const response = await fetch('https://api.onlyoneapi.com/v1/endpoint', {
 headers: {
  'Authorization': 'Bearer YOUR_API_KEY',
  'Content-Type': 'application/json'
 }
});

OAuth2 Authentication

For user-delegated access

For applications that need to access OnlyOneAPI on behalf of users, we support OAuth2 authentication flow.

OAuth2 Flow

// 1. Redirect user to authorization URL
const authUrl = 'https://auth.onlyoneapi.com/oauth/authorize?' +
 'client_id=YOUR_CLIENT_ID&' +
 'redirect_uri=YOUR_REDIRECT_URI&' +
 'response_type=code&' +
 'scope=read write';

// 2. Exchange authorization code for access token
const tokenResponse = await fetch('https://auth.onlyoneapi.com/oauth/token', {
 method: 'POST',
 headers: { 'Content-Type': 'application/json' },
 body: JSON.stringify({
  grant_type: 'authorization_code',
  code: authorizationCode,
  client_id: YOUR_CLIENT_ID,
  client_secret: YOUR_CLIENT_SECRET
 })
});

Security Best Practices

Keep your API secure

Never expose API keys in client-side code

Always keep API keys on your server

Use environment variables

Store keys in .env files, never in code

Rotate keys regularly

Generate new keys every 90 days

Use IP whitelisting

Restrict API access to known IPs

Ready to authenticate?

Now that you understand authentication, start building with our APIs.