Skip to main content

generateCode

Send a one-time code to the user.

This feature works only if it is enabled in the admin panel (opens in a new tab).

Description​

Asks OneEntry to generate a one-time code and send it to the user through the notification channel set up in the admin panel. Use it to resend an activation code or to start a password reset. Resolves to an empty object {} on success.

eventIdentifier must be the marker of an event with the Send code form type in the Events module, otherwise the API returns 404. Requesting a new code too soon after the last one returns 429.

.generateCode(

, ,

);

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"

Examples​

Minimal example​

const response = await AuthProvider.generateCode('email', 'john@example.com', 'user_registration');