OMX Logo
Core Auth

Authentication & Configuration

Learn how to authenticate and configure the OMX Core SDK for your application.

Authentication & Configuration

Build with confidence

The OMX SDK uses API key authentication to secure your requests. Configure the client for different environments and customize behavior to match your application's needs.

Basic Authentication

Quick Start
Initialize the OMX client with your API credentials to start making authenticated requests.
typescript
1import { createOmxClient } from '@omx-sdk/core';
2
3const omx = createOmxClient({
4 clientId: process.env.OMX_CLIENT_ID,
5 secretKey: process.env.OMX_SECRET_KEY
6});
7
8// You're ready to make API calls!
9const geoTrigger = await omx.geoTrigger.create({
10 name: "My First Trigger",
11 location: { lat: 40.7128, lng: -74.0060 },
12 radius: 100
13});

Getting Your API Keys

1

Sign up for an OMX account

Create your account at console.oxinion.com

2

Create a new project

Set up a project for your application

3

Copy your credentials

Get your Client ID and Secret Key from the dashboard

Configuration Options

Environment Configuration
Configure the SDK for different deployment environments with appropriate settings.
typescript
1// Development vs Production
2const omx = createOmxClient({
3 clientId: process.env.OMX_CLIENT_ID,
4 secretKey: process.env.OMX_SECRET_KEY,
5
6 // Environment-specific settings
7 environment: process.env.NODE_ENV, // 'development' | 'production'
8 debug: process.env.NODE_ENV === 'development',
9 timeout: process.env.NODE_ENV === 'development' ? 30000 : 10000,
10 retries: process.env.NODE_ENV === 'development' ? 1 : 3
11});
Custom Base URL
Override the default API endpoint for testing or custom deployments.
typescript
1const omx = createOmxClient({
2 clientId: process.env.OMX_CLIENT_ID,
3 secretKey: process.env.OMX_SECRET_KEY,
4 baseUrl: 'https://api-staging.oxinion.com/v1' // Custom endpoint
5});
Request Timeouts & Retries
Configure how the SDK handles network issues and timeouts.
typescript
1const omx = createOmxClient({
2 clientId: process.env.OMX_CLIENT_ID,
3 secretKey: process.env.OMX_SECRET_KEY,
4
5 timeout: 15000, // 15 second timeout
6 maxRetries: 3, // Retry failed requests 3 times
7 retryDelay: 1000 // Wait 1 second between retries
8});

Error Handling

Authentication Error Handling
Gracefully handle authentication failures and network issues.
typescript
1try {
2 const result = await omx.geoTrigger.create(triggerData);
3} catch (error) {
4 switch (error.code) {
5 case 'INVALID_CREDENTIALS':
6 console.error('Invalid API credentials');
7 break;
8 case 'RATE_LIMITED':
9 console.log('Rate limited, retry after:', error.retryAfter);
10 break;
11 case 'NETWORK_ERROR':
12 console.error('Network connection failed');
13 break;
14 default:
15 console.error('API error:', error.message);
16 }
17}

Advanced Authentication Features

JWT Tokens
Enhanced security with JSON Web Tokens for enterprise applications
Multi-Tenant Support
Isolated authentication and data access per tenant organization

Environment Variables

Recommended Environment Variables
Set these environment variables for secure credential management.
bash
1# Required Authentication
2OMX_CLIENT_ID=your_client_id
3OMX_SECRET_KEY=your_secret_key

Next Steps

Core Utilities

Explore utility functions and helpers available in the OMX Core module.

Learn More
Start with Geotriggers

Create location-based triggers and start building your first OMX workflow.

Get Started