initScenid(serviceKey, options?)
Configures the SDK. Call it once when your process starts.
import { initScenid } from '@scenid/cloud-sdk'
initScenid(serviceKey)
| Parameter | Type | Description |
|---|---|---|
serviceKey | ServiceKey | The parsed service key |
options | object | Accepted but currently unused |
Validation
Throws Error with one of:
initScenid: client_id is requiredinitScenid: client_secret is requiredinitScenid: token_uri is required
If neither cloud_stack nor issuer is present, new URL(undefined) throws a TypeError while the service URLs are derived.
What it does
- Creates the shared
Authinstance. - Computes the base domain:
cloud_stack(withhttpifssl: false), otherwise the origin ofissuer. - Builds the per-service URLs (see below).
Calling it again reinitialises everything. Useful in tests, avoid it in production code.
Service URLs
resolveServiceUrl(service, baseUrl) replaces or prepends the first host label:
| Service | Subdomain |
|---|---|
SERVICES.AUTH | auth |
SERVICES.CUSTOMERS | crm-service |
SERVICES.INSIGHTS | insights-service |
SERVICES.FILES | file-service |
| Base URL | Auth URL |
|---|---|
https://example.com | https://auth.example.com |
https://prod.example.com | https://auth.example.com |
http://localhost:3000 | http://auth.localhost:3000 |
An unknown service name throws sdk/unknown-service: <name>.