Skip to content

Configuration

Learn how to configure the ExtensionLogin SDK for your needs.

Initialization Options

Pass configuration options when initializing:

javascript
import ExtensionLogin from 'extensionlogin';

ExtensionLogin.init({
  // Required
  apiKey: 'el_live_xxxxxxxxxxxxxx',

  // Optional
  debug: false,
  autoIdentify: false,
  storage: 'local',
  apiUrl: 'https://api.extensionlogin.com'
});

Options Reference

OptionTypeDefaultDescription
apiKeystringRequiredYour ExtensionLogin API key
debugbooleanfalseEnable debug logging to console
autoIdentifybooleanfalseAuto-identify users from storage on init
storage'local' | 'sync' | 'none''local'Chrome storage type for user data
apiUrlstring'https://api.extensionlogin.com'API endpoint (for self-hosted)

API Key Types

ExtensionLogin uses different API key prefixes for different environments:

PrefixEnvironmentPurpose
el_live_ProductionLive production traffic
el_test_TestingDevelopment and testing

Use Test Keys in Development

Use el_test_ keys during development. They won't count against your user limits and make it easy to identify test data.

Storage Options

Local Storage (Default)

User data is stored in chrome.storage.local:

javascript
ExtensionLogin.init({
  apiKey: 'el_live_xxx',
  storage: 'local'
});
  • Persists across browser sessions
  • Not synced between devices
  • Larger storage limits (~5MB)

Sync Storage

User data is synced across devices:

javascript
ExtensionLogin.init({
  apiKey: 'el_live_xxx',
  storage: 'sync'
});
  • Syncs across user's Chrome devices
  • Smaller limits (~100KB)
  • Requires user to be signed into Chrome

No Storage

Disable local storage entirely:

javascript
ExtensionLogin.init({
  apiKey: 'el_live_xxx',
  storage: 'none'
});
  • User data not persisted locally
  • Must re-identify on each session
  • Useful for privacy-sensitive applications

Auto-Identify

Automatically restore user session on initialization:

javascript
ExtensionLogin.init({
  apiKey: 'el_live_xxx',
  autoIdentify: true
});

// Later, check if user is already identified
const user = ExtensionLogin.getUser();
if (user) {
  console.log('Welcome back,', user.email);
}

Debug Mode

Enable detailed logging for development:

javascript
ExtensionLogin.init({
  apiKey: 'el_live_xxx',
  debug: true
});

// Console will show:
// [ExtensionLogin] Initialized with API key: el_live_xxx...
// [ExtensionLogin] Making request to /sdk/identify
// [ExtensionLogin] Response: { success: true, ... }

Environment-Based Configuration

Use different configurations for development and production:

javascript
const isDev = chrome.runtime.getManifest().version === '0.0.0';

ExtensionLogin.init({
  apiKey: isDev ? 'el_test_xxx' : 'el_live_xxx',
  debug: isDev,
  storage: isDev ? 'local' : 'sync'
});

Or use build-time environment variables:

javascript
ExtensionLogin.init({
  apiKey: process.env.EXTENSIONLOGIN_API_KEY,
  debug: process.env.NODE_ENV === 'development'
});

Multiple Extensions

If you have multiple extensions sharing an account, create separate applications in the dashboard and use different API keys:

javascript
// Extension A
ExtensionLogin.init({ apiKey: 'el_live_extension_a_key' });

// Extension B
ExtensionLogin.init({ apiKey: 'el_live_extension_b_key' });

Each extension's users will be tracked separately in the dashboard.

Rate Limits

ExtensionLogin enforces rate limits to ensure fair usage:

PlanRequests/minuteRequests/day
Free601,000
Pro30010,000
EnterpriseUnlimitedUnlimited

When rate limited, the SDK will:

  1. Return an error response with code: 'RATE_LIMITED'
  2. Include retryAfter indicating when to retry
javascript
const result = await ExtensionLogin.identify({ email: '[email protected]' });

if (!result.success && result.error?.code === 'RATE_LIMITED') {
  console.log('Rate limited. Retry after:', result.error.retryAfter);
}

Next Steps

Built for Chrome Extension Developers