MyDomainDiscoverableLogin configures the My Domain login experience when the login page type is Discovery. Discovery uses an identity-first login experience: the initial page shows only an identifier field, which can ask for an email address, phone number, or custom identifier. An Apex handler uses the submitted identifier to determine how to authenticate the user.
This component configures the handler, the user who executes it, and the identifier prompt. Its presence alone does not establish that Discovery is the active My Domain login page type. It also does not prescribe a single authentication method.
Key Elements
| Element | What the Element Controls |
|---|---|
apexHandler |
Required. References the ApexClass containing the Discovery authentication logic. Changing the class reference or its implementation can change how users log in. |
executeApexHandlerAs |
Identifies the user who executes the handler. That user requires the Manage User permission. |
usernameLabel |
Supplies the identifier prompt on the Discovery login page. Supports localization through custom labels. The prompt does not determine how the identifier is interpreted or how authentication proceeds. |
Behavior and Constraints
The handler controls authentication; the prompt supplies guidance. For example, a usernameLabel value of Enter your email asks the user for an email address, but that wording does not create an email-based authentication rule. The handler determines what the submitted value means and which authentication steps follow.
Discovery can use a multistep login process. Subsequent steps can include sending a verification code and asking the user to enter it. Verification-code entry is an example, not a requirement imposed by this metadata type.
apexHandler is an authentication dependency, not just a presentation setting. Login behavior can change when the referenced class changes, even if executeApexHandlerAs and usernameLabel remain unchanged. The execution user must have the Manage User permission.
Deployment and Retrieval
Components use the .myDomainDiscoverableLogin file suffix and reside in the myDomainDiscoverableLogins directory. The type extends Metadata and inherits its fullName field.
In package.xml, use MyDomainDiscoverableLogin as the metadata type name. The type supports the wildcard member *, so a retrieval manifest can request its components without listing each member individually.
When moving this configuration between orgs, account for the ApexClass referenced by apexHandler and the user identified by executeApexHandlerAs, including that user's Manage User permission. Do not treat the retrieved component's presence as confirmation that the destination org uses Discovery as its active login page type.
Relationships
The direct metadata dependency is the Apex class that implements Discovery authentication. The execution user supplies the handler's execution context, while custom labels support localization of the identifier prompt.
References
-
ApexClass:apexHandler.
Common Questions
Does deploying MyDomainDiscoverableLogin activate Login Discovery?
The component's presence alone does not establish that Discovery is the active My Domain login page type. It defines the configuration used when the login page type is Discovery.
What permission does the Login Discovery execution user need?
The user identified by executeApexHandlerAs requires the Manage User permission.
Does usernameLabel control whether users authenticate by email or phone?
No. usernameLabel supplies user-facing guidance and supports localization. The Apex handler interprets the identifier and determines how to authenticate the user.
How do I retrieve MyDomainDiscoverableLogin metadata?
Include MyDomainDiscoverableLogin in package.xml; wildcard member * is supported. Component files use the .myDomainDiscoverableLogin suffix in the myDomainDiscoverableLogins directory.