Auth0 Home Blog Docs

Verification Email automatically created for custom database connections?

Hi there,

after reading a lot in the docs im still not sure: Are verification emails automatically created? I’m using a connection with a custom database and I’m not getting any verfication emails although verification emails are activated under “Emails -> Templates” and I have a working smtp connection set up. Password reset emails do work.

I found this https://auth0.com/docs/email/custom article, which has an example code for creating a verification email manually. But i can’t really believe that this is neccessary because

  1. The password reset email works out of the box, no custom code needed. So why would the verification email be different?
  2. It seems like a big hassle to manually get access tokens and and then manually call the management api via post request (like it’s external code/software, but actually it’s inside an auth0 rule) to simply create a verification email, which is actually a default functionality of auth0.

So I’m totally confused right now, whether I need to create them manually by calling the management api from a rule or if they should work out of the box.

Thanks!

Hello @Marius,

Welcome to the Community! If you have enabled and configured the verification email, there should be no need to customize the template to get it to work. It has a default template. Are the verification emails going to spam? You can also try searching your logs for fv, fvr, sv, svr event types:

type:fv* or type:sv*

Thanks for your quick response! No Mails in Spam, no logs with

type:fv* or type:sv*

But now I think I’m coming closer to the problem. When signing up, I get a HTTP 500 response from
https://tagxter.eu.auth0.com/dbconnections/signup

{“message”:“Mail has not been verified (activation link)”,“fromSandbox”:true}

The logs show

Type: Failed Signup
Description: Mail has not been verified (activation link)

(but the user is created in the database!)

The message Mail has not been verified (activation link) is my error message from the login script.

To me it looks like some internal process is trying to instantly login the user after sign up, which of course fails, and then no activation mail is sent because the whole sign up process failed with an error.

When testing my sign up script of the database connection, it works. There is no verification check in this script. The error message mentioned above only exists in the login script.

How do I prevent the login script from being automatically executed on sign up?

@Marius if you are testing the signup using Lock, by default it will attempt to log the user in after sign up. The Lock loginAfterSignUp configuration attribute that can be set to false to prevent this:

I’m using the reuglar web app login like described in https://auth0.com/docs/quickstart/webapp/php

when i press “sign up” it creates the signup call to
https://tagxter.eu.auth0.com/dbconnections/signup with the 500 error, returning my error message from the login script. The ui shows

WE’RE SORRY, SOMETHING WENT WRONG WHEN ATTEMPTING TO SIGN UP.

(user is created in the database, but no mail is sent)
Is there any similar setting for the default web login?

FYI, if someone is having the same problem: Still could not find a way to prevent the custom database login script being executed on signup. But I managed to solve my problem by moving the “is email verified?” check from the login script to a rule. This way the signup API call gets through and the verification mail is being send.

@Marius thanks for providing your update. To clarify, custom database connections will always run the login script after the create script - this is to verify that the user has successfully been created in the database and login attempts will work. Error responses during this process will cause the error to be throw from the /dbconnections/signup endpoint.

In short, both the login script and create script must successfully return the user profile from the custom database.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.