--- title: Custom login sequence slug: '3289' canonical_url: https://docs.coveo.com/en/3289/ collection: index-content source_format: adoc --- # Custom login sequence The default login sequence for Web and Sitemap sources supports various third-party login pages, such as OneLogin, Google, Salesforce, and Microsoft. The default login sequence also tries to detect and log in to first-party login forms. The login process uses the first `
` element that meets all requirements. **Form requirements for the default login sequence**
Details The form must contain the following elements: **User identity field**: A visible `` element whose `id` or `name` attribute value is either `user`, `email`, `login`, `id`, or `name` (case-insensitive). **Password field**: A visible `` element whose `type` attribute value is `password` (case-insensitive). **Submit element**: A visible form submit element. The source looks for the following element types, in this order: * An `` element whose `type` attribute value is `submit` or `button`. * A `
If the web page doesn't meet the requirements for the default login sequence, or if your form requires specific actions during the login process, you must configure a [custom login sequence](https://docs.coveo.com/en/3289/). If the web page doesn't meet the requirements for the default login sequence, or if your form requires specific actions during the login process, you must configure a custom login sequence. [Web](https://docs.coveo.com/en/malf0160/) and [Sitemap](https://docs.coveo.com/en/1967/) sources provide an interface that lets administrators build custom form [authentication](https://docs.coveo.com/en/2120/) workflows. > **Important** > > Ensure that the default source login sequence fails before you configure a custom login sequence. There's no need to set or adjust the form authentication **Loading delay** when you configure a custom login sequence. Custom login sequences are not affected by the form authentication **Loading delay** specified in the source configuration. If you need to interact with Shadow DOM elements, make sure the [**Wait delay** on your first step](#add-a-step) allows the Shadow DOM to load before the first action on a page is executed. Use the `CSS selector` [element identifier type](#element-identifier-type) to target Shadow DOM elements. See [element identifier](#element-identifier) for more details on the CSS selector syntax you must use. ## Add login sequence conditions and steps The default **Custom login sequence** section configuration is the following: ![Screenshot of the custom login sequence interface showing options to define conditions and organize login steps | Coveo](https://docs.coveo.com/en/assets/images/index-content/add-custom-login-sequence-conditions-and-steps.png) You can: 1 Add conditions that must be met for your custom login sequence to be executed. When these conditions aren't met, the source will perform the standard Coveo form authentication process. 2 [Add a step](#add-a-step) to the custom login sequence. When no steps are defined, the crawler attempts form authentication without a custom login sequence. As you add steps, the **Login steps** section displays the steps you've added in the order in which they will be executed. ![Edit custom login sequence steps interface | Coveo](https://docs.coveo.com/en/assets/images/index-content/source-edit-custom-login-sequence-steps.png) At this stage of the custom login sequence configuration process, you can also: 3 Change the order of steps in the custom login sequence by dragging them up or down. 4 [Edit a step](#add-a-step) in the custom login sequence. 5 Remove a step from the custom login sequence. ## Add a step When you add a step to the login sequence, the **Add a custom login sequence step** panel appears with a default action configuration that remains to be completed. ![Edit a new custom login sequence step | Coveo](https://docs.coveo.com/en/assets/images/index-content/edit-newly-created-custom-login-sequence-step.png) At this stage, you can: 1 Name the step. 2 Set the wait time in milliseconds before executing the step. 3 Add conditions that must be met for the step to be executed. Use step conditions to handle periodically displayed pop-up windows and visual elements (for example, a "Verify your identity" page). 4 [Configure actions](#configure-an-action) in the step. 5 [Add an action](#configure-an-action) to the step. 6 Save or cancel your step configuration changes. ### Configure an action A fully defined action configuration has between 2 and 6 parameters, depending on the action type. These parameters are: * [Action type](#action-type) * [Wait delay](#wait-delay) * [Element identifier type](#element-identifier-type) * [Element identifier](#element-identifier) * [Element type](#element-type) * [Value](#value) #### Action type The keyboard or pointer action to perform. > **Note** > > With many action types, the target element must meet certain _preconditions_ before the action is actually attempted. > The source first tries to [scroll into view](https://w3c.github.io/webdriver/#dfn-scrolls-into-view) the target element, if necessary. > Then, the source ensures the element is in view, displayed, and can be [interacted with](https://w3c.github.io/webdriver/#interactability), before executing the action. **Options**
Details * `Click`: Simulates a mouse click on an element. For interactability preconditions to be met, the target element must have a height and width greater than 0. * `JavaScript click`: Simulates a mouse click on an element, but it doesn't check preconditions. * `Clear`: Checks preconditions, and then clears the content of the input element. * `Type`: Checks preconditions, and then types the text specified in the **Value** field into the target input element. When you select `Username` in the **Element type** menu, the source automatically uses the username specified in the form authentication credentials as the **Value**. When you select `Password` in the **Element type** menu, the source automatically uses the password specified in the form authentication credentials as the **Value**. * `Press tab`: Simulates selecting the `Tab` key. `Press tab` can often be used to set the focus on the password input element after filling out the username input element. * `Press space`: Simulates selecting the `Space` key. * `Press enter`: Simulates selecting the `Enter` key. * `Submit form`: Checks preconditions, and then performs the action of submitting the form. [TIP] **Leading practice**
The `Click` action type is recommended over `Submit form`. #### * `Press key`: Simulates selecting a key on the keyboard. > **Leading practice** > > Use `Press tab`, `Press space`, or `Press enter` instead of `Press key` when possible. ##### ==== Wait delay The time in milliseconds to wait before executing the action. #### Element identifier type The method to use to find the target HTML element. **Options**
Details * `Name`: Used to select an element based on its `name` attribute value. * `ID`: Used to select an element based on its `id` attribute value. * `Tag name`: Used to select an element based on the tag name. * `Class name`: Used to select an element based on its `class` attribute value. * `CSS selector`: Used to select an element by specifying a CSS selector. * `XPath`: Used to select an element by specifying an XPath expression.
#### Element identifier The value to use to identify the target form element based on the selected **Element identifier type**. For example, if you select `ID` as the **Element identifier type**, specify the `id` attribute value of the target form element in the **Element identifier** field. To interact with Shadow DOM elements, you must use the `CSS Selector` element identifier type and your element identifier must include the `>>shadow` custom marker. **Example** Consider the following DOM structure containing a light DOM `
` element to which a Shadow DOM is attached: ```text - DIV id="host" #shadow-root - FORM - INPUT id="password" ``` To target the `` element, you can use the following CSS selector: `#host >>shadow #password`. #### Element type The type of the form element. **Options**
Details * `Default`: Use `Default` for all non-username, non-password elements used in the login sequence. * `Username`: Used to identify the `` element in which users enter their username or email address to authenticate with. When used in a `Type` action, the source automatically types the form authentication username in the `` element. * `Password`: Used to identify the `` element in which users enter their password. When used in a `Type` action, the source automatically types the form authentication password in the `` element.
#### Value The text to type in the input field when the **Action Type** is `Type`. When you select `Username` or `Password` as the **Element type**, the source automatically uses the credentials specified in the form authentication login details as the **Value**. ### Manage actions As you add actions to a step, the **Actions** section displays the actions you've added in the order in which they will be executed. ![Manage actions in a custom login sequence step | Coveo](https://docs.coveo.com/en/assets/images/index-content/custom-login-sequence-manage-step-actions.png) At this stage, you can: 1 Change the order of actions in the step by dragging them up or down. 2 Remove an action from the step. ## Custom login sequence limitations Custom login sequences have the following limitations: * They can contain up to five steps. * All steps can contain up to ten actions. * If more than one step contains a `Type` [action](#action-type) on a `Password` [element](#element-type), all these steps must be conditional. * A step can have no more than one `Type` [action](#action-type) on a `Password` [element](#element-type). ## Example 1: Custom login sequence for a Web source using the Microsoft Online login page The following example shows a custom login sequence for a source using the Microsoft Online login page. This is for demonstration purposes only, as the standard Coveo form authentication process already handles the Microsoft Online login page. > **Note** > > This example uses **Wait delay** values to ensure the crawler waits for the input elements to load before executing actions. > Consider the time required for your login sequence elements to load and adjust the **Wait delay** values accordingly. Custom login sequence conditions and steps ![Custom login sequence conditions and steps example | Coveo](https://docs.coveo.com/en/assets/images/index-content/source-custom-login-sequence-conditions-and-steps.png) Step configurations ![Custom login sequence example - Step 1 configurations](https://docs.coveo.com/en/assets/images/index-content/custom-login-sequence-example-step-1.png) {empty} ![Custom login sequence example - Step 2 configurations](https://docs.coveo.com/en/assets/images/index-content/custom-login-sequence-example-step-2.png) {empty} ![Custom login sequence example - Step 3 configurations](https://docs.coveo.com/en/assets/images/index-content/custom-login-sequence-example-step-3.png) ## Example 2: Custom login sequence with a cookie consent step In the following example, an authentication page located at `+https://example.com/auth/manual?lang=en+` includes a cookie consent overlay. The input fields in the login form become accessible after cookie consent has been accepted. The image below illustrates the authentication page with the cookie consent overlay, along with the HTML markup of the elements used in the custom login sequence. ![Authentication page that includes cookie consent button | Coveo](https://docs.coveo.com/en/assets/images/index-content/custom-login-sequence-example.png) The cookie consent overlay is only displayed the first time the crawler accesses the authentication page. If the crawler accesses the page again during the content update operation, the cookie consent overlay won't appear. As a result, the `Accept Cookie Consent` step in the custom login sequence is made conditional on the presence of text displayed in the cookie consent overlay. Custom login sequence conditions and steps ![Custom login sequence high-level configuration | Coveo](https://docs.coveo.com/en/assets/images/index-content/cls-example-2-cls-configuration.png) Step configurations ![Custom login sequence step 1 configuration | Coveo](https://docs.coveo.com/en/assets/images/index-content/cls-example-2-step-1-configuration.png) {empty} ![Custom login sequence step 2 configuration | Coveo](https://docs.coveo.com/en/assets/images/index-content/cls-example-2-step-2-configuration.png) {empty} ![Custom login sequence step 3 configuration | Coveo](https://docs.coveo.com/en/assets/images/index-content/cls-example-2-step-3-configuration.png)