Email Authentication enables users to authenticate and recover their Turnkey accounts using email-based verification. There are two methods of email authentication:
alphanumeric
must be set to false
otpLength
must be set to 6
000000
ACTIVITY_TYPE_INIT_OTP
using the parent organization id with these parameters:
otpType
: specify "OTP_TYPE_EMAIL"
contact
: user’s email addressemailCustomization
: optional parameters for customizing emailsuserIdentifier
: optional parameter for rate limiting SMS OTP requests per user.
We recommend generating this server-side based on the user’s IP address or public key.
See the OTP Rate Limits section below for more details.alphanumeric
: optional parameter for making this code bech32 alphanumeric or not. default: trueotpLength
: optional parameter for selecting the length of the OTP. default: 9expirationSeconds
: optional validity window (defaults to 5 minutes)sendFromEmailAddress
: optional custom email address from which to send the OTP emailsendFromEmailSenderName
: optional custom sender name for use with sendFromEmailAddress; if left empty, will default to ‘Notifications’replyToEmailAddress
: optional custom email address to use as reply-toACTIVITY_TYPE_VERIFY_OTP
using the parent organization id which returns a verificationToken JWT:
otpId
: ID from the init activityotpCode
: the 6-9 digit or alphanumeric code received via emailexpirationSeconds
: optional validity window (defaults to 1 hour)ACTIVITY_TYPE_OTP_LOGIN
using the sub orgazanition ID associated with the contact from the first step:
publicKey
: public key to add to organization data associated with the signing key in IndexedDB or SecureStorage.verificationToken
: JWT returned from successfull VERIFY_OTP
activityexpirationSeconds
: optional validity window (defaults to 15 minutes)invalidateExisting
: optional boolean to invalidate previous login sessionsuserIdentifier
parameter is provided, the following limits are enforced:
userIdentifier
ACTIVITY_TYPE_EMAIL_AUTH
with these parameters:
email
: user’s email address (must match their registered email)targetPublicKey
: public key for credential encryptionapiKeyName
: optional name (defaults to Email Auth - <Timestamp>
)expirationSeconds
: optional validity window (defaults to 15 minutes)emailCustomization
: optional parameters for customizing emailsinvalidateExisting
: optional boolean to invalidate previous Email Auth API keysappName
: the name of the application. This will be used in the email’s subject, e.g. Sign in to ${appName}
logoUrl
: a link to a PNG with a max width of 340px and max height of 124pxmagicLinkTemplate
: a template for the URL to be used in the magic link button, e.g. https://dapp.xyz/%s
. The auth bundle will be interpolated into the %s
emailCustomization
variable may look like:
alice and bob
can be interpolated into the email template using the key username
. The use of such template variables is purely optional.
Here’s an example of a custom HTML email containing an email auth bundle:
sendFromEmailAddress
or it’s invalid, the other two fields are ignoredsendFromEmailSenderName
is absent, it defaults to “Notifications” (again, ONLY if sendFromEmailAddress
is present and valid)replyToEmailAddress
is absent, then there is no reply-to added. If it is present, it must ALSO be from a valid, whitelisted domain, but it doesn’t have to be the same email address as the sendFromEmailAddress
one (though once again, this first one MUST be present, or the other two feature are ignored)ACTIVITY_TYPE_INIT_OTP
, ACTIVITY_TYPE_VERIFY_OTP
and ACTIVITY_TYPE_OTP_LOGIN
ACTIVITY_TYPE_EMAIL_AUTH
FEATURE_NAME_OTP_EMAIL_AUTH
for OTP-based authenticationFEATURE_NAME_EMAIL_AUTH
for credential bundle authenticationACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE
to disable:
FEATURE_NAME_OTP_EMAIL_AUTH
for OTP-based authenticationFEATURE_NAME_EMAIL_AUTH
for credential bundle authenticationdisableOtpEmailAuth
parameter for OTP-based authenticationdisableEmailAuth
parameter for credential bundle authenticationACTIVITY_TYPE_SET_ORGANIZATION_FEATURE
CreateSubOrganizationIntentV7
activity parameters