HeadlessSelfRegistrationHandler Interface
Creates customer and partner users during the Headless Registration Flow.
The Headless Registration Flow allows you to control user registration experience in a third-party app while using Salesforce to authenticate users and manage their data access. When you set up this flow, add users in the class that is implementing the Auth.HeadlessSelfRegistrationHandler interface. This class runs after the user verifies their identity. For a detailed explanation of headless registration, see Headless Registration Flow for Private Clients or Headless Registration Flow for Public Clients, depending on your app type.
-
HeadlessSelfRegistrationHandler Methods
The following are methods for
HeadlessSelfRegistrationHandler. -
HeadlessSelfRegistrationHandler Example Implementation
This example class implements the
Auth.HeadlessSelfRegistrationHandlerinterface to create a user. It finds or creates an account to store the new user and creates a contact to associate with the account. It then creates the user based on information that your client sends to Headless Registration API.
The following are methods for HeadlessSelfRegistrationHandler.
-
createUser(profileId, data, customUserDataMap, experienceId, password)
Returns a User object using information submitted by your off-platform app to Headless Registration API. The User object can be a new user that hasn’t been inserted in your org’s database, or it can represent an existing user record. If it’s a new User object, Salesforce inserts the user record for you.
Returns a User object using information submitted by your off-platform app to Headless Registration API. The User object can be a new user that hasn’t been inserted in your org’s database, or it can represent an existing user record. If it’s a new User object, Salesforce inserts the user record for you.
public User createUser(Id profileId, Auth.UserData data, String customUserDataMap, String experienceId, String password)
-
profileId:
Type: Id
The ID of the profile that is assigned to new users.
-
data:
Type: Auth.UserData
A class that stores information about the user, such as their name and locale.
-
customUserDataMap:
Type: String
A string representation of a JSON object containing custom user information passed in during registration. We recommend that you deserialize this string into the equivalent Apex class structure. Determine what custom information to collect when you build your app’s registration experience.
-
experienceId:
Type: String
A custom value that determines what the end user experiences.
-
password:
Type: String
The user password.
Type: User
This example class implements the Auth.HeadlessSelfRegistrationHandler interface to create a user. It finds or creates an account to store the new user and creates a contact to associate with the account. It then creates the user based on information that your client sends to Headless Registration API.