Skip to main content

Embedded Recovery Flow (V2)

executeEmbeddedRecoveryFlowV2 drives a step-by-step account recovery flow (e.g., password reset) without a browser redirect.

executeEmbeddedRecoveryFlowV2(config)

Initiate or advance a V2 embedded recovery flow.

import { executeEmbeddedRecoveryFlowV2, EmbeddedRecoveryFlowStatusV2 } from '@thunderid/javascript'

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

// Step 2 — Provide the username/email to recover
const step2 = await executeEmbeddedRecoveryFlowV2({
baseUrl: 'https://localhost:8090',
payload: {
executionId: step1.executionId,
inputs: {
username: 'user@example.com',
},
},
})

// Step 3 — Submit the OTP/token received by email
const step3 = await executeEmbeddedRecoveryFlowV2({
baseUrl: 'https://localhost:8090',
payload: {
executionId: step2.executionId,
inputs: {
otp: '123456',
},
challengeToken: step2.challengeToken,
},
})

if (step3.flowStatus === EmbeddedRecoveryFlowStatusV2.Complete) {
// Recovery complete — prompt user for new password
}

Parameters

ParameterTypeRequiredDescription
config.urlstringFull endpoint URL. Mutually exclusive with baseUrl
config.baseUrlstringThunderID base URL
config.payloadEmbeddedRecoveryFlowRequestV2Flow request body
config.payload.applicationIdstringApplication ID. Required for the first step
config.payload.flowTypestringRecovery flow type (e.g., 'PASSWORD_RECOVERY'). Required for first step
config.payload.executionIdstringExecution ID from a prior response
config.payload.actionstringAction to take at the current step
config.payload.inputsRecord<string, string>Step input fields
config.payload.challengeTokenstringChallenge token from a prior step

Response: EmbeddedRecoveryFlowResponseV2

PropertyTypeDescription
executionIdstringID to pass in subsequent requests
flowStatusEmbeddedRecoveryFlowStatusV2Current flow status
typeEmbeddedRecoveryFlowTypeV2View or Redirection
dataEmbeddedFlowResponseDataV2Component tree or redirect data
challengeTokenstringPresent when a verification step is required
failureReasonstringPresent when flowStatus is Error

Enums

EmbeddedRecoveryFlowStatusV2

ValueDescription
IncompleteMore steps required
CompleteRecovery completed successfully
ErrorRecovery failed — check failureReason

EmbeddedRecoveryFlowTypeV2

ValueDescription
ViewRender the component tree in data
RedirectionRedirect to redirectUrl
ThunderID LogoThunderID Logo

Product

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