Cant send email to users that doesnt show on dashboard - Custom Database

Hello!

On the auth0 dashboard, new users only appear after first login, but I need them to be verified in order to get access to my company API.
After creating an user on my custom-database, I tried using the management API to send them an email, but it shows this error:

{'statusCode': 400, 'error': 'Bad Request', 'message': 'The user does not exist', 'errorCode': 'inexistent_user'}

but when going to the “get user” function on the auth0 it returns me:

The profile is: {"user_id":"xxxx","name":"Test","email":"xxxxxx","account_id":xxxx}

So the user exists on the database, but not on the auth0 database.

If I manually active my account on the custom database, and log in, the user will appear on the dashboard, and then I can send them the email.

Is there a way to put my new users on the custom-database before first login?
or
Send emails to users not on the auth0 dashboard?

Thanks!

Hi @arthurmluz,

Welcome to the Auth0 Community!

I understand that you are having trouble sending verification emails to your users that reside in your Custom Database.

First, could you please confirm if you have implemented the Verify script in your Custom Database?

Although it is not required to implement the Verify script, it’s a recommended best practice. Implementing the Verify script will provide support for user email address verification as stated in our documentation: https://auth0.com/docs/connections/database/custom-db/templates/verify

Looking forward to your response.

Thank you.

Hi @rueben.tiow,

Yes, I have implemented the Verify script in the custom database, and I’ve already tested it, and it’s working properly.

My problem is that Auth0 only gets a user from the custom database, after its first login. So new users don’t appear on the dashboard until then.

If I try sending an email to an account that already logged in for the first time via the management API, the email will be sent, and it will work properly.

If I try sending an email to an account that hasn’t logged in, the email won’t be sent, since auth0 doesn’t have it on the user’s list yet.

The problem is: I want users to verify their email after creating the account and before first log in.

Thanks!

Hi @arthurmluz,

Thank you for your response.

First, I’d like to clarify that your observations are correct. Auth0 is unaware of your Custom Database users until they log in for the first time.

Since it’s not possible to send a verification email until the user logs in at least once, I recommend you try the following flow as a workaround:

  1. Use a Force Email Verification Rule
  2. And include a call to the Management API to send an email verification email to the user

Here is the documentation for how to use the Management API within Rules: https://auth0.com/docs/rules/use-management-api

If applicable, you could also:

  1. Import the users from your Custom DB into Auth0 first
  2. Then call the Management API programmatically to send an email address verification email to the user

Doing so should prevent users from logging in without a verified email.

Let me know how this works for you.

Thank you.

1 Like

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