Interface: IdoSdk

Interface

Description

The interface for the sdk object.

Methods

init

init(clientId, options?): Promise<void>

Description

Creates a new Identity Orchestration SDK instance with your client context. Do not call this function directly - see below how to initialize via the unified web SDK

Throws

InvalidInitOptions in case of invalid init options.

Example

Copy
Copied
// Initialize an instance of the Identity Orchestration SDK using the unified SDK
await window.tsPlatform.initialize({
  clientId: 'my-client-id',
  ido: { serverPath: 'https://api.transmitsecurity.io/ido'}
});

Parameters

Name Type Description
clientId string Client ID for this application.
options? IdoInitOptions Additional environment configuration for the SDK operation.

Returns

Promise<void>

The promise that will be resolved when the SDK is initialized.


startJourney

startJourney(journeyId, options?): Promise<IdoServiceResponse>

Description

Starts a Journey with a given id.

Throws

NotInitialized - Throws error if the SDK is not initialized.

Throws

NetworkError - Throws error if could not connect to server, or server did not respond before timeout.

Throws

ServerError - Throws error if the server returned an unexpected error.

Example

Copy
Copied
// Start a Journey with the id 'my-journey-id'
try {
  const idoResponse = await window.tsPlatform.ido.startJourney('my-journey-id', { additionalParams: 'additionalParams' });
  // Handle Journey response
} catch(error) {
  switch(sdkError.errorCode) ...
}

Parameters

Name Type Description
journeyId string Journey Identifier in the Mosaic Admin Console.
options? StartJourneyOptions Additional parameters to be passed to the journey.

Returns

Promise<IdoServiceResponse>

The promise that will be resolved when the IdoServiceResponse is received.


startSsoJourney

startSsoJourney(interactionId): Promise<IdoServiceResponse>

Description

Starts an SSO Journey with a given Interaction ID.

Throws

NotInitialized - Throws error if the SDK is not initialized.

Throws

NetworkError - Throws error if could not connect to server, or server did not respond before timeout.

Throws

ServerError - Throws error if the server returned an unexpected error.

Example

Copy
Copied
// Start a Journey with the Interaction ID '2456E855-05A0-4992-85C1-A2519CBB4AA7'
try {
  const idoResponse = await window.tsPlatform.ido.startSsoJourney('2456E855-05A0-4992-85C1-A2519CBB4AA7');
  // Handle Journey response
} catch(error) {
  switch(sdkError.errorCode) ...
}

Parameters

Name Type Description
interactionId string Interaction identifier given as part of the response to the initial /authorize request

Returns

Promise<IdoServiceResponse>

The promise that will be resolved when the IdoServiceResponse is received.


submitClientResponse

submitClientResponse(clientResponseOptionId, data?): Promise<IdoServiceResponse>

Description

This method will submit client input to the Journey step to process.

Throws

NotInitialized - Throws error if the SDK is not initialized.

Throws

NoActiveJourney - Throws error if the SDK state does not have an active Journey.

Throws

NetworkError - Throws error if could not connect to server, or server did not respond before timeout.

Throws

ClientResponseNotValid - Throws error if the client response to the Journey is not valid.

Throws

ServerError - Throws error if the server returned an unexpected error.

Example

Copy
Copied
// The previous response may include multiple response options. The standard 'ClientInput' response option
// signals we are sending collected user input to the journey step.
const selectedInputOptionId = ClientResponseOptionType.ClientInput;

// Submit the client input. The data inside the JSON correspond to the expected fields from the Journey step.
try {
  const idoResponse = await window.tsPlatform.ido.submitClientResponse(selectedInputOption, {
    'userEmail': 'user@input.email',
    'userPhone': '111-222-3333',
  });
} catch(sdkError) {
  switch(sdkError.errorCode) ...
}

Parameters

Name Type Description
clientResponseOptionId string The response option ID is one of the IDs provided in the clientResponseOptions. This would either be ClientInput for collected user input, or one of the others if another journey path was selected by the user.
data? any The client response data object. Mandatory in ClientInput response option type, populate with data for the Journey step to process. Optional in Cancel and Custom as an additional parameters for the branch.

Returns

Promise<IdoServiceResponse>

The promise that will be resolved when the IdoServiceResponse is received.


serializeState

serializeState(): string

Description

Get the current serialized state of the SDK. Can be stored by the application code and used to restore the SDK state following page redirects or refresh

Returns

string

The current state of the SDK.


restoreFromSerializedState

restoreFromSerializedState(state): IdoServiceResponse

Description

Restores the SDK state from a serialized state, can be used to recover from page redirects or refresh. The application code also receives the latest communication from the orchestration server.

Throws

InvalidState - Throws error if the provided state string is invalid.

Parameters

Name Type Description
state string The state to restore from.

Returns

IdoServiceResponse

The last IdoServiceResponse that was received before the state was saved.


generateDebugPin

generateDebugPin(): Promise<string>

Description

This method will generate a debug PIN const debugPin = await sdk.generateDebugPin(); console.log(Debug PIN: ${debugPin}); // Output: Debug PIN: 1234

Returns

Promise<string>