Overview
Completes the OTP authentication flow by verifying the OTP code and then either signing up or logging in the user.- This function first verifies the OTP code for the provided contact and OTP type.
- If the contact is not associated with an existing sub-organization, it will automatically create a new sub-organization and complete the sign-up flow.
- If the contact is already associated with a sub-organization, it will complete the login flow.
- Supports passing a custom public key for authentication, invalidating existing session, specifying a session key, and providing additional sub-organization creation parameters.
- Handles both email and SMS OTP types.
Package: core
Defined in: core.ts:1432
Parameters
Response
A successful response returns the following fields:A promise that resolves to an object containing:
sessionToken
: the signed JWT session token.verificationToken
: the OTP verification token.action
: whether the flow resulted in a login or signup (AuthAction).