Install an SDK
YorAuth SDKs wrap the REST API so you do not have to manage raw HTTP calls, token storage, or header signing yourself.
Official SDKs are currently in development. The installation commands and usage examples below show the intended API. Sign up for early access at app.yorauth.com.
JavaScript / TypeScript
Works in Node.js and modern browsers (React, Vue, Nuxt, Next.js, etc.).
Install
npm install @yorauth/js
Initialize
import { YorAuth } from '@yorauth/js';
const auth = new YorAuth({
applicationId: 'your-application-id',
apiKey: 'sk_live_...', // Server-side only — never expose in the browser
});
Register a user
const { data } = await auth.users.register({
email: 'jane@example.com',
password: 'Secure1!Pass',
name: 'Jane Smith',
});
console.log(data.id); // UUID of the created user
Log a user in
const { data } = await auth.users.login({
email: 'jane@example.com',
password: 'Secure1!Pass',
});
const { access_token, refresh_token, expires_in, user } = data;
PHP
Install
composer require yorauth/php-sdk
Initialize
use YorAuth\Client;
$auth = new Client(
applicationId: 'your-application-id',
apiKey: 'sk_live_...',
);
Register a user
$response = $auth->users()->register(
email: 'jane@example.com',
password: 'Secure1!Pass',
name: 'Jane Smith',
);
echo $response->data->id;
Log a user in
$response = $auth->users()->login(
email: 'jane@example.com',
password: 'Secure1!Pass',
);
$accessToken = $response->data->access_token;
$refreshToken = $response->data->refresh_token;
Configuration Reference
Both SDKs accept the same two required options:
| Option | Type | Description |
|---|---|---|
applicationId | string | Your YorAuth application UUID from the dashboard |
apiKey | string | The API key generated in the API Keys section of your application |
Never include an API key in client-side (browser) code. API keys are for server-side use only. Client-side authentication should use the JWT access token returned from the login endpoint.
Without an SDK
If you prefer to call the API directly, all endpoints are documented in the API reference. The base URL for all multi-tenant endpoints is:
https://api.yorauth.com/api/v1/applications/{applicationId}/
Include your API key in requests that require it as a Bearer token in the Authorization header:
Authorization: Bearer sk_live_...
See First API Call for a working example with raw HTTP.