Skip to main content
Methods on the email flow of a createAuthClient client. sendOtp emails the user a one-time code; verifyOtp exchanges it for a Dynamic user JWT.

sendOtp

Function Signature

Parameters

  • email (string) - The user’s email address. Dynamic sends the one-time code to it.

Returns

  • verificationUUID (string) - Identifies this verification attempt. Pass it to verifyOtp together with the code.

verifyOtp

Function Signature

Parameters

  • verificationUUID (string) - The value returned by sendOtp.
  • code (string) - The one-time code the user received by email. Collect it through your own channel; never log or persist it.
  • sessionPublicKey (string, optional) - Compressed P-256 public key hex from generateSessionKeyPair. Binds the session key into the minted JWT — required if you will use a session signer with authenticateJwt for backUpToDynamic flows.

Returns

  • Promise<AuthResult> - { jwt, expiresAt, userId }. Pass jwt to authenticateJwt; never log it.

Example

Error Handling

sendOtp and verifyOtp are rate limited per IP address (429 when exceeded) — see Rate Limit Policies.
Last modified on July 17, 2026