The Captcha module presents a CAPTCHA challenge during onboarding to verify human interaction and reduce automated abuse. It then returns the user's response to your app.
In Dashboard, Captcha isn't a standalone module. Instead, enable one-time password (OTP) verification in the settings of the Email Input and Phone Number Input modules.
How you use this module depends on your integration pattern. When your app defines the steps in code, you add the module to an IncdOnboardingFlowConfiguration as shown below; when the flow is defined in Dashboard, you reference it by session token and let the back end drive the steps. See Integration Approaches.
Availability: All variants.
Add Captcha
Add the module with addCaptcha(). It takes no parameters.
flowConfig.addCaptcha()
Example
The example below adds Captcha as the only step in the flow and reads the result from the onCaptchaCompleted(_:) delegate callback.
let flowConfig = IncdOnboardingFlowConfiguration()
flowConfig.addCaptcha()
IncdOnboardingManager.shared.startOnboarding(
sessionConfig: IncdOnboardingSessionConfiguration(token: "<SESSION_TOKEN>"),
flowConfig: flowConfig,
delegate: self
)
// IncdOnboardingDelegate
func onCaptchaCompleted(_ result: CaptchaResult) {
// CAPTCHA step completed. Process the result.
}
Configuration Options
Captcha has no configurable options.
Result
Captcha delivers a CaptchaResult to the onCaptchaCompleted(_:) callback on IncdOnboardingDelegate.
func onCaptchaCompleted(_ result: CaptchaResult)
CaptchaResult fields:
captcha: String?: The entered CAPTCHA value.nilwhen the step did not complete successfully.error: CaptchaError?: Set when the step failed; otherwise,nil.
Errors
Failures surface through CaptchaResult.error as a CaptchaError:
error(IncdError): Wraps an underlyingIncdError.wrongCaptchaEntered: The value entered did not match.captchaNotGenerated: No CAPTCHA was generated for the session.