checkCode
Check a one-time code.
Description
Checks a one-time code without using it up. Resolves to true if the code is correct and false if it isn't. Each wrong code counts as a failed attempt: after five, the code is invalidated and the API returns 429, so request a new one with generateCode(). An unknown user returns 400, and an unknown or inactive provider returns 404.
.checkCode(
,
,
,
);
Parameters schema
Schema
marker(required): string
Marker of the auth provider.
example: "email"
userIdentifier(required): string
Identifier (login) of the user, such as an email address.
example: "john@example.com"
eventIdentifier(required): string
Marker of the event the code is generated for.
example: "user_registration"
code(required): string
One-time code the user received.
example: "123456"
Examples
Minimal example
const response = await AuthProvider.checkCode('email', 'john@example.com', 'user_registration', '123456');
Example response
true
Try it live
Run this method in the JS SDK sandbox. Connect your Project URL and App Token on first visit, then open:
- Password reset: verify the code the user received via email or SMS before resetting their password.