# How to verify user account email?

**URL:** <https://forum.heroiclabs.com/t/how-to-verify-user-account-email/3148>\
**Category:** Game Design\
**Tags:** authentication\
**Created:** [October 11, 2022, 12:53pm UTC](https://forum.heroiclabs.com/t/how-to-verify-user-account-email/3148 "2022-10-11T12:53:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shahariar\_Ashik](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@Shahariar\_Ashik](https://forum.heroiclabs.com/u/Shahariar_Ashik)\
**Post date:** [October 11, 2022, 12:53pm UTC](https://forum.heroiclabs.com/t/how-to-verify-user-account-email/3148/1 "2022-10-11T12:53:37Z")

</div>

How to verify user account if they create account using email?

---

<div class="post-metadata">

**Author:** ![sesposito](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.heroiclabs.com/sesposito/32/2594_2.png) [@sesposito](https://forum.heroiclabs.com/u/sesposito)\
**Post date:** [October 11, 2022, 2:08pm UTC](https://forum.heroiclabs.com/t/how-to-verify-user-account-email/3148/2 "2022-10-11T14:08:16Z")

</div>

I’d suggest you use a 3rd party service to send your verification email using an [after hook](https://heroiclabs.com/docs/nakama/guides/server-framework/using-hooks/#after-hooks) on `AuthenticateEmail`. If the account is newly created, the `created` property in `Session` is set to true.

To prevent the user from logging in until verification happens (or gating other features) you could use a [before hook](https://heroiclabs.com/docs/nakama/guides/server-framework/using-hooks/#before-hooks) on AuthenticateEmail that uses the runtime [accountsGetId function](https://heroiclabs.com/docs/nakama/server-framework/typescript-runtime/function-reference/#accountsGetId) to check whether the account exists, if it does, check the account `verifyTime` (a value \> 0 would signify the account is verified if the verification flow is set up correctly), otherwise allow `AuthenticateEmail` to go through to create the new account.

As for handling the verification, please see: [Email Verification Status](https://forum.heroiclabs.com/t/email-verification-status/1363). The easiest would be to set up a separate server to receive the email verification token and then use a [S2S server call](https://heroiclabs.com/docs/nakama/server-framework/introduction/index.html#server-to-server) to set the `verify_time` as described in the thread above.

Hope this helps.
