Skip to main content

initScenid(serviceKey, options?)

Configures the SDK. Call it once when your process starts.

import { initScenid } from '@scenid/cloud-sdk'

initScenid(serviceKey)
ParameterTypeDescription
serviceKeyServiceKeyThe parsed service key
optionsobjectAccepted but currently unused

Validation​

Throws Error with one of:

  • initScenid: client_id is required
  • initScenid: client_secret is required
  • initScenid: 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​

  1. Creates the shared Auth instance.
  2. Computes the base domain: cloud_stack (with http if ssl: false), otherwise the origin of issuer.
  3. 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:

ServiceSubdomain
SERVICES.AUTHauth
SERVICES.CUSTOMERScrm-service
SERVICES.INSIGHTSinsights-service
SERVICES.FILESfile-service
Base URLAuth URL
https://example.comhttps://auth.example.com
https://prod.example.comhttps://auth.example.com
http://localhost:3000http://auth.localhost:3000

An unknown service name throws sdk/unknown-service: <name>.