ContactChannel
ContactChannel
represents a user's contact information, such as an email address or phone number. Some auth methods, like OTP/magic link or password, use contact channels for authentication.
On this page:
ContactChannel
Basic information about a contact channel, as seen by a user themselves.
Usually obtained by calling user.listContactChannels()
or user.useContactChannels()
.
Table of Contents
The id of the contact channel as a string
.
declare const id: string;
The value of the contact channel. If type is "email"
, this is an email address.
declare const value: string;
The type of the contact channel. Currently always "email"
.
declare const type: 'email';
Indicates whether the contact channel is the user's primary contact channel. If an email is set to primary, it will be the value on the user.primaryEmail
field.
declare const isPrimary: boolean;
Indicates whether the contact channel is verified.
declare const isVerified: boolean;
Indicates whether the contact channel is used for authentication. If set to true
, the user can use this contact channel with OTP or password to sign in.
declare const usedForAuth: boolean;
Sends a verification email to this contact channel. Once the user clicks the verification link in the email, the contact channel will be marked as verified.
Parameters
None.
Returns
Promise<void>
declare function sendVerificationEmail(): Promise<void>;
await contactChannel.sendVerificationEmail();
Updates the contact channel. After updating the value, the contact channel will be marked as unverified.
Parameters
options
objectrequiredAn object containing properties for updating.
Show Properties
value
stringThe new value of the contact channel.
type
'email'The new type of the contact channel. Currently always "email"
.
usedForAuth
booleanIndicates whether the contact channel is used for authentication.
isPrimary
booleanIndicates whether the contact channel is the user's primary contact channel.
Returns
Promise<void>
declare function update(options: {
value?: string;
type?: 'email';
usedForAuth?: boolean;
isPrimary?: boolean;
}): Promise<void>;
await contactChannel.update({
value: "new-email@example.com",
usedForAuth: true,
});
declare function delete(): Promise<void>;
await contactChannel.delete();
ServerContactChannel
Like ContactChannel
, but includes additional methods and properties that require the SECRET_SERVER_KEY
.
Usually obtained by calling serverUser.listContactChannels()
or serverUser.useContactChannels()
.
Table of Contents
Updates the contact channel.
This method is similar to the one on ContactChannel
, but also allows setting the isVerified
property.
Parameters
options
objectrequiredAn object containing properties for updating.
Show Properties
value
stringThe new value of the contact channel.
type
'email'The new type of the contact channel. Currently always "email"
.
usedForAuth
booleanIndicates whether the contact channel is used for authentication.
isVerified
booleanIndicates whether the contact channel is verified.
isPrimary
booleanIndicates whether the contact channel is the user's primary contact channel.
Returns
Promise<void>
declare function update(options: {
value?: string;
type?: 'email';
usedForAuth?: boolean;
isVerified?: boolean;
isPrimary?: boolean;
}): Promise<void>;
await serverContactChannel.update({
value: "new-email@example.com",
usedForAuth: true,
isVerified: true,
});