Get Instant Solutions for Kubernetes, Databases, Docker and more
SuperTokens is an open-source authentication solution designed to simplify the process of adding secure authentication to your applications. It offers features like session management, social login, and email verification, making it a comprehensive tool for developers looking to implement authentication quickly and securely.
When using SuperTokens, you might encounter the EMAIL_NOT_VERIFIED
error. This typically manifests as users being unable to access certain features or functionalities within your application that require a verified email address.
The EMAIL_NOT_VERIFIED
error indicates that the user's email address has not been verified. This is a common requirement in applications to ensure that the email provided by the user is valid and accessible by them. Without verification, users may be restricted from accessing certain parts of the application.
Email verification helps in maintaining the integrity of user data and prevents unauthorized access. It ensures that the email address provided is legitimate and owned by the user.
To resolve the EMAIL_NOT_VERIFIED
issue, follow these steps:
Ensure that your application is configured to send a verification email upon user registration. You can use SuperTokens' built-in email delivery service or integrate with third-party services like SendGrid or Mailgun.
const { sendEmailVerification } = require('supertokens-node/recipe/emailverification');
async function sendVerificationEmail(userId) {
await sendEmailVerification(userId);
}
Once the verification email is sent, prompt the user to check their inbox and follow the verification link. This can be done through a notification or a message on your application's user interface.
Ensure that your application correctly handles the verification link. When the user clicks the link, it should redirect them to a page in your application that confirms their email has been verified.
const { verifyEmail } = require('supertokens-node/recipe/emailverification');
async function verifyUserEmail(token) {
const result = await verifyEmail(token);
if (result.status === 'OK') {
// Email verified successfully
} else {
// Handle error
}
}
By following these steps, you can effectively resolve the EMAIL_NOT_VERIFIED
issue in your application. Ensuring that users verify their email addresses not only enhances security but also improves user trust in your application. For more detailed information, refer to the SuperTokens Documentation.
(Perfect for DevOps & SREs)
Try Doctor Droid — your AI SRE that auto-triages alerts, debugs issues, and finds the root cause for you.