CustomOneTimePasswordDeliveryHandler Interface
To use a custom SMS provider to send one-time passwords (OTPs) for Experience Cloud identity verification, create a class that implements the Auth.CustomOneTimePasswordDeliveryHandler interface.
The following are methods for CustomOneTimePasswordDeliveryHandler.
-
sendOneTimePassword(userId, phoneNumber, oneTimePassword, networkId, defaultText, expId)
Calls out to an external SMS messaging provider to send a Salesforce one-time password to an external user for identity verification. Returns an
Auth.CustomOneTimePasswordDeliveryResultindicating whether the provider sent the message.
Calls out to an external SMS messaging provider to send a Salesforce one-time password to an external user for identity verification. Returns an Auth.CustomOneTimePasswordDeliveryResult indicating whether the provider sent the message.
public Auth.CustomOneTimePasswordDeliveryResult sendOneTimePassword(Id userId, String phoneNumber, String oneTimePassword, String defaultText, Id networkId, String experienceId)
-
userId:
Type: Id
ID of the external user.
-
phoneNumber:
Type: String
The user’s phone number. The phone number isn’t necessarily verified by Salesforce.
-
oneTimePassword:
Type: String
The OTP that the user receives.
-
networkId:
Type: String
ID of the Experience Cloud site.
-
defaultText:
Type: Id
The content of the default SMS message that the user receives. You can create custom messages instead of sending the default. For example, write code to send custom messages based on the Experience Cloud site ID.
-
expId:
Type: String
A custom value that determines what the user experiences.
Type: Auth.CustomOneTimePasswordDeliveryResult
This example implements the Auth.CustomOneTimePasswordDeliveryHandler interface. For a detailed explanation of this example, see Example: Custom One-Time Password Delivery Handler in Salesforce Help.