Auth0 User Redirection After Email Verification

Overview

Administrators can handle the redirection of users to an application after they complete email verification by using verification emails, a Management API email job, or a Management API verification ticket. Customize the redirect URL for each case to ensure users reach the correct destination after verifying their email address.

Applies To

  • Auth0
  • Email Verification
  • Management API

Solution

How does redirection work when the Verification Email template is enabled?

When administrators enable the Verification Email template, Auth0 sends a verification email when a user signs up or an administrator creates the user from the Dashboard or using the Management API. When the user clicks the verification link in the email, Auth0 redirects them to the URL that administrators configure in the Redirect To URL field for that email template.

Configure dynamic redirect URLs by utilizing the available variables in the Redirect To URL field.

 

Configure the Email Verification Ticket Endpoint With a Result URL

When using the POST /api/v2/tickets/email-verification Management API endpoint, administrators can specify a result URL in the request body. Auth0 generates an email verification ticket, and the administrator must provide this URL to the user. Auth0 does not send an email in this scenario. Once the user clicks the verification ticket link, Auth0 redirects them to the specified result_url.

{  
  "user_id": "string",  
  "result_url": "string",  
  "ttl_sec": 0, 
  "includeEmailInRedirect": true  
}

 

NOTE: The ttl_sec parameter defines the number of seconds for which the ticket is valid before expiration. If unspecified or set to 0, this value defaults to 432000 seconds (5 days).

 

What happens when the email verification ticket endpoint uses a client ID?

Use the POST /api/v2/tickets/email-verification endpoint and specify the client_id of an application instead of a result_url in the request body. Auth0 generates the email verification ticket, and the administrator must provide it to the user. Auth0 does not send an email. When the user clicks the verification ticket link, Auth0 displays a confirmation screen indicating that Auth0 verified the email, along with a Back to app button. When the user clicks the button, Auth0 redirects them to the Default Login URI of the specified application.

Configure the request by using the following payload.

{  
  "user_id": "string",  
  "client_id": "string",  
  "ttl_sec": 0, 
  "includeEmailInRedirect": true  
}

Send a Verification Email Using the Management API Jobs Endpoint

When administrators use the POST /api/v2/jobs/verification-email Management API endpoint, Auth0 sends a verification email to the user, identical to the signup process. Administrators must enable the Verification Email template in the tenant for this endpoint to function. When the user clicks the verification link in the email, Auth0 redirects them to the URL that administrators configure in the Redirect To URL field for that email template.

 

Related References

Recommended content

No recommended content found...