/api/user/verify-email doesn't resend the verification email
-
I'm trying to use /api/user/verify-email to resend the activation email, but nothing happens.
When I call this method, I got 200 response code and an empty body
PUT https://example.com/api/user/verify-email?email=me%40example.com
When setting the Authorization header, I got JSON with verificationId but again, no emails were sent.
-
Happy Friday! The API that you have listed is only for simply marking users as "email-verified." (see here)
Sending the verification email requires a separate API call (aka resend verification email) or would be fired when the user is registered to your application. Here are some places to check on
tenant
andapplication
to ensure you can send verification emails when a user registers for your application.At the tenant level
Ensure you have the SMTP server set up to ensure that emails can be sent.
At the application level
You will want to ensure:
- That you don't have
skipVerification
set totrue
when a user registers for an application via API.
See this option under - https://fusionauth.io/docs/v1/tech/apis/registrations/ - Your application has
verifyRegistration
set to true. This can be set programmatically via the API or via the admin UI.
See below
Via API
(https://fusionauth.io/docs/v1/tech/apis/applications/)
Via Admin UI
I hope this helps!
Thanks,
Josh - That you don't have
-
Happy Friday! The API that you have listed is only for simply marking users as "email-verified." (see here)
But according to documentation, it is about to resend the email
New users receive emails about verification, but I want to make a button in my application to resend this email, and right now I see 200 responses with an empty body.
-
Sorry to hear that you are still having problems.
But according to documentation, it is about to resend the email
I was a bit confused, there are two API calls that are related.
- The first call should be PUT
/api/user/verify-email?email={email}
. - The second should be POST
/api/user/verify-email?verificationId={verificationId}
takes the verificationId obtained in the first call and marks the user as email verified via API.
I spun up FusionAuth and was able to get this email to send by calling the API.
Let's see if we can retrace our steps to find out what may be happening. To start, this was the command I ran and the result.
curl --location --request PUT 'http://localhost:9011/api/user/verify-email?email=<my_email@my_email.com>' \ --header 'Authorization: <API KEY>' \ --header 'X-FusionAuth-TenantId: <TENANT_ID>'
should return
{ "verificationId": "SOME_REALLY_LONG_ALPHANUMERIC_STRING" }
status: 200
I find it interesting that you are getting a 200 OK, and no response body.
Have you verified that you have verify registration set up (toggled) on the Tenant and Application level (the application level is optional, depending on the behavior you want for your customers) as well as the ability to send a test email in the SMTP setting under the tenant?
if you have those three things configured, as well as an appropriately provisioned API key and correct tenant ID, the above cURL command has a high chance of working for you.
If this is still not working, any other recreate steps might be helpful in diagnosing.
Below are some over annotated screenshots that might help
I will let you know if I can think of anything else in the meantime.
Thanks,
Josh - The first call should be PUT
-