How to get user_id at Redirect To URL at Email Templates of Verify Email using Link

Upon user registration, a verification email is dispatched for confirmation.

Upon clicking the verification link, I understand that we utilize the “Branding” settings, specifically the “Email Templates” section where there is a “Redirect To” option. Following my investigation, I have noted that three variables—application.name, application.clientID, and application.callback_domain—are available for use in the Redirect To URL.

My specific inquiry pertains to obtaining the user_id during this process.
I aim to receive the user_id in the URL and subsequently update the ‘verifyflag’ associated with that user_id in our internal database.

Could you kindly guide me on how I can retrieve the user_id in this context? Any assistance or insights you can provide would be greatly appreciated.

Thank you for your valuable support!

Hi @binh.tieu,

Thanks for reaching out to the Auth0 Community!

Unfortunately, the user_id is not a callable attribute for the Redirect To field. Only application.name, application.clientID, and application.callback_domain are callable variables for the Redirect To field.

As a workaround, you can manually update the verify flag in your internal database once the user has verified the email address. This approach can be combined with a log streaming service to monitor Success Verification Email (sv log event type) logs and update the verify flag accordingly.

Alternatively, you could use a Post-Login Action to programmatically update the verify flag in your internal database whenever a user logs in. However, this could affect the freshness of the data in your internal database, as it’s contingent on the user logging in after they have verified their email address. Thus, for this to work, you could redirect the user back to your login page to prompt them to login and allow this flow to execute.

Please let me know if you have any questions.

Thanks,
Rueben

2 Likes

Hi, this morning, I tried your suggestion about log-streaming
It worked.
I created a custom webhook


In a custom webhook, I call the payload URL which is my API endpoint. With body payload, I got user_id and I can update verify flag for my external database
Thanks for you suggestion.

1 Like

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