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.applicationIdstringNoApplication ID. Required for the first step
config.payload.flowTypestringNoFlow type. Required for the first step (e.g., 'SIGN_IN')
config.payload.executionIdstringNoExecution ID from a prior response. Required for subsequent steps
config.payload.actionstringNoAction to take at the current step
config.payload.inputsRecord<string, string>NoStep-specific input fields (e.g., credentials)
config.payload.challengeTokenstringNoChallenge token from a prior step (e.g., for MFA)
config.authIdstringNoOptional 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
errorFlowErrorPresent when flowStatus is Error or Incomplete. Contains code, message, and description

Enums

EmbeddedSignInFlowStatusV2

ValueDescription
IncompleteFlow has more steps
CompleteAuthentication succeeded: use assertion to obtain tokens
ErrorAuthentication failed, check error for details

EmbeddedSignInFlowTypeV2

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

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.