Display an email identifier
An account settings screen needs to show a user's current email address.
Clerk · Class
EmailAddress is Clerk's model for a user's email identifier, including its value, identity metadata, linked identifications, and verification state. Use its methods to start verification, remove the address, or obtain its string value.
EmailAddress represents one email identifier belonging to the current user. It exposes the address value, identity metadata, and verification state, and provides methods for creating, deleting, stringifying, and beginning verification.
class EmailAddressAn EmailAddress object exposes the email address, its identifier and metadata, verification state, and linked identifications; toString() returns the address value.
const email = user.primaryEmailAddress;
if (email?.verification?.status === "verified") {
console.log(email.toString());
}Reads the current user's primary email and uses its verification status before displaying the address.
An account settings screen needs to show a user's current email address.
An application must start ownership confirmation for a newly added address.
A profile-management flow removes an obsolete address from the current user.
A security-sensitive action requires confirmed email ownership.
EmailAddress is a model for an email identifier associated with a user. Its properties include the address value, a unique ID, SSO-match information, verification state, and linked identifications.
Follow-up: How would you determine whether it is safe to use the address? Check the verification property's status and require the verified state before treating ownership as confirmed.
Call prepareVerification() to start verification. Clerk then sends either an OTP or a verification link according to the selected strategy and dashboard configuration.
Follow-up: What should be inspected after preparation? Read the verification property to track the resulting verification state.
toString() returns the email value, which is also available through the emailAddress property. destroy() deletes the email address from the current user.
Follow-up: Which operation should be used when only formatting the object for display? Use toString(), not destroy(), because destroy() removes the address.
UserVerificationResourceIdentificationLinkResourceprepareVerification()attemptVerification()