Skip to main content
The Verify script implements the function executed to mark the verification status of a user’s email address in an external database. We recommend naming this function verify. This script is only used in legacy authentication scenarios, and is required to support user email address verification. A verified email address is critical to a number of workflow scenarios in Auth0, and implementing this script will provide support for these out of the box. If it’s enabled, this script is executed when a user clicks on the link in the verification email sent by Auth0.

Verify function

The verify function should:
  • Update the email_verified (or equivalent) attribute in the user’s profile in the external database.
  • Return true if the update action succeeded.
  • Return an error if the update action failed.

Definition

The verify function accepts two parameters and returns a callback function:
ParameterTypeDescription
emailStringUser’s email address.
callbackFunctionUsed to pass error or profile data through the pipeline.

Example

This is a pseudo-JavaScript example of how you could implement the login function. For language-specific examples, read Language-specific script examples.

Callback function

The callback function is used to pass user profile data or error data through the pipeline.

Definition

The callback function accepts up to two parameters and returns a function:
ParameterTypeRequiredDescription
errorObjectRequiredContains error data.
verifiedBooleanOptionalContains value that represents the user’s verification status in the external database (true or false). Only required if the value is true.

Return a success

If the user’s verification status was updated successfully in the external database, pass a null value for the error parameter, and a true value for the verified parameter.
The Verify script does not change the value of the email_verified attribute in the user’s Auth0 profile, regardless of what value is returned in the callback function.To update the email_verified attribute in the user’s Auth0 profile, you must include the email_verified attribute and its value in the user profile object returned in the Login and Get User scripts.

Example

Return an error

If an error occurs, the error parameter should contain relevant information about what went wrong.

Example

Language-specific script examples

Auth0 provides sample scripts for use with the following languages/technologies:

JavaScript

ASP.NET Membership Provider (MVC3 - Universal Providers)

ASP.NET Membership Provider (MVC4 - Simple Membership)

MongoDB

MySQL

PostgreSQL

SQL Server

Windows Azure SQL Database

Learn more