Skip to main content

Embedded Sign-In Flow (V2)

executeEmbeddedSignInFlowV2 drives a step-by-step sign-in sequence using the V2 flow protocol. It supports a richer response model with explicit error states, challenge tokens for multi-factor flows, and assertion-based completion.

executeEmbeddedSignInFlowV2(config)

Initiate or advance a V2 embedded sign-in flow. Call it first without executionId to start the flow, then pass the returned executionId on subsequent calls.

import { executeEmbeddedSignInFlowV2, EmbeddedSignInFlowStatusV2 } from '@thunderid/javascript'

// Step 1 — Initiate the flow
const step1 = await executeEmbeddedSignInFlowV2({
baseUrl: 'https://localhost:8090',
payload: {
applicationId: '<your-app-id>',
flowType: 'SIGN_IN',
},
})

// Step 2 — Submit credentials
const step2 = await executeEmbeddedSignInFlowV2({
baseUrl: 'https://localhost:8090',
payload: {
executionId: step1.executionId,
inputs: {
username: 'user@example.com',
password: 'password123',
},
},
})

if (step2.flowStatus === EmbeddedSignInFlowStatusV2.Complete) {
const assertion = step2.assertion // Use to complete the OAuth code exchange
}

Parameters

ParameterTypeRequiredDescription
config.urlstringFull endpoint URL. Mutually exclusive with baseUrl
config.baseUrlstringThunderID base URL
config.payloadEmbeddedSignInFlowRequestV2Flow request body
config.payload.applicationIdstringApplication ID. Required for the first step
config.payload.flowTypestringFlow type. Required for the first step (e.g., 'SIGN_IN')
config.payload.executionIdstringExecution ID from a prior response. Required for subsequent steps
config.payload.actionstringAction to take at the current step
config.payload.inputsRecord<string, string>Step-specific input fields (e.g., credentials)
config.payload.challengeTokenstringChallenge token from a prior step (e.g., for MFA)
config.authIdstringOptional authentication context ID

Response: EmbeddedSignInFlowResponseV2

PropertyTypeDescription
executionIdstringID to pass in subsequent requests
flowStatusEmbeddedSignInFlowStatusV2Current status of the flow
typeEmbeddedSignInFlowTypeV2View or Redirection
dataEmbeddedFlowResponseDataV2UI component tree or redirect data for the current step
assertionstringPresent when flowStatus is Complete. Use to exchange for tokens
challengeTokenstringPresent when a challenge is required (e.g., TOTP step)
redirectUrlstringPresent when type is Redirection
failureReasonstringPresent when flowStatus is Error

Enums

EmbeddedSignInFlowStatusV2

ValueDescription
IncompleteFlow has more steps
CompleteAuthentication succeeded — use assertion to obtain tokens
ErrorAuthentication failed — check failureReason

EmbeddedSignInFlowTypeV2

ValueDescription
ViewThe data field contains a component tree to render
RedirectionRedirect the user to redirectUrl
ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© WSO2 LLC. All rights reserved.Privacy PolicyCookie Policy