---
schema_version: "1"
id: 1d79bdde096925319b6a6535596bad22298079a4fba1fd2990811cfcb0823e80
title: Run Custom Components as the Logged-In User in Enhanced Web Chat
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/service/264-0-0/miaw_custom_component_user_context.md
canonical_url: https://help.salesforce.com/s/articleView?id=service.miaw_custom_component_user_context.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 614a16d47f50ec38f6e04f6aba7995d015e6944ea969b38b7e8b4a11c5f98910
description: When you add a custom Lightning web component to your embedded service deployment, it runs as an unauthenticated guest user in the chat window, even when a user is logged in to your Experience Cloud site. To run the component as a logged-in site user instead, add the user's profile or permission set to the Embedded Service site's member list. Running the component as the logged-in user gives the custom component access to read and act on the user's data.
products:
  - Service Cloud
  - Digital Engagement
release: "264"
---
# Run Custom Components as the Logged-In User in Enhanced Web Chat

When you add a custom Lightning web component to your embedded service deployment, it runs as an unauthenticated guest user in the chat window, even when a user is logged in to your Experience Cloud site. To run the component as a logged-in site user instead, add the user's profile or permission set to the Embedded Service site's member list. Running the component as the logged-in user gives the custom component access to read and act on the user's data.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <tbody>
          <tr class="">
            <td class="slds-cell-wrap" colspan="2" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=service.messaging_editions.htm&amp;type=5&amp;language=en_US" target="_blank">View supported editions.</a></td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <a name="miaw_custom_component_user_context__d271e1065"><!-- --></a><span style="vertical-align:text-bottom;display:inline-block;"><img style="margin-bottom:0;" id="miaw_custom_component_user_context__d271e1065" src="https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/resources-global/_corporate/images/checkmark.png" alt="Checkmark"></span>
              <strong>This article applies to:</strong>
            </td>

            <td class="slds-cell-wrap" style="vertical-align:top;">Enhanced Web Chat channels</td>

          </tr>
          <tr class="">
            <td class="slds-cell-wrap" style="vertical-align:top;">
              <span style="vertical-align:text-bottom;display:inline-block;"><img style="margin-bottom:0;" src="https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support_channels-264-0-0-production-enus/f3c4b3d2-ff86-4f7c-9fe2-3d8b23d35109/resources-global/_corporate/images/crossmark.png" alt="X icon"></span>
              <strong>This article doesn’t apply to:</strong>
            </td>

            <td class="slds-cell-wrap" style="vertical-align:top;">Enhanced In-App Chat, Enhanced WhatsApp, Enhanced Facebook Messenger, Standard
              and Enhanced SMS, Enhanced Apple Messages for Business, Enhanced LINE, and Bring Your
              Own Channel</td>

          </tr>
        </tbody>
      </table> <table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d18268e96">User Permissions</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions" class="slds-cell-wrap" style="vertical-align:top;" headers="d18268e96 ">To set up this feature:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d18268e96 ">
              <p>Customize Application </p>
              <p style="margin-bottom:0;">AND Modify Metadata Through Metadata API Functions</p>
            </td>

          </tr>
          <tr class="">
            <td data-label="User Permissions" class="slds-cell-wrap" style="vertical-align:top;" headers="d18268e96 ">To modify permission sets and profiles:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d18268e96 ">Manage Profiles and Permission Sets</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions" class="slds-cell-wrap" style="vertical-align:top;" headers="d18268e96 ">To add the Embedded Messaging component to an Experience Builder site:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d18268e96 ">Create and Setup Experiences</td>

          </tr>
        </tbody>
      </table>

Before you begin:

- Add your custom component to your embedded service deployment.
- Make sure that the Experience Cloud site and Embedded Service site use the same domain.
- [Set up credential-based user verification for your Enhanced Web Chat deployment](https://help.salesforce.com/s/articleView?id=service.miaw_credential_user_verification_setup.htm&release=264.0.0&type=5 "Credential-based user verification lets authenticated customers view their messaging conversation history when chatting in Enhanced Web Chat on a Salesforce site.").

1. Identify the profiles and permission sets that you want to give the custom component access to.
    1. From Setup, in the Quick Find box, enter All Sites, and then select **All Sites**.
    2. Next to your Experience Cloud site, select **Workspaces**.
    3. Click **Administration** and then select the **Members** tab.
    4. Review the selected profiles and permission sets and determine which ones you want to add to the Embedded Service site's member list.
2. Add the profiles and permission sets that you identified earlier as Embedded Service site members. By default, the Salesforce admin profile is a member of the Embedded Service site.
    1. On the All Sites Setup page, select **Workspaces** next to your Embedded Service site. Embedded Service site names start with `ESW`.
    2. Click **Administration** and then select the **Members** tab.
    3. Select the profiles and permission sets.
    4. Save your changes.
3. To confirm that the custom component runs as the logged-in user, open your Experience Cloud site and log in as a user whose profile you added. Then open the chat window and confirm that the custom component shows the logged-in user's data instead of the guest user's data. Repeat the test as a user whose profile and permission sets you didn't add.

To stop the component from running as a logged-in user, remove that user's profile or permission set from the Embedded Service site's member list.

#### See Also

- [Personalize the Enhanced Chat v2 UI with Custom Lightning Types](https://help.salesforce.com/s/articleView?id=service.enhanced_chat_v2_lightning_types.htm&release=264.0.0&type=5 "Custom Lightning types enable you to customize the chat UI in Lightning Experience.")
- [Configure an Enhanced Web Chat Deployment in an Experience Builder or Commerce Cloud Site](https://help.salesforce.com/s/articleView?id=service.miaw_deployment_experience_builder.htm&release=264.0.0&type=5 "Use the Embedded Messaging component to add Enhanced Web Chat to your Experience Builder or Commerce Cloud site.")
- [Persist Secure Messaging History Across Multiple Devices with User Verification](https://help.salesforce.com/s/articleView?id=service.user_verification.htm&release=264.0.0&type=5 "To maximize data privacy, securely connect your customers to their messaging history and persist conversations across devices with token-based or credential-based user verification. Persist conversations across devices with token-based user verification.")
- [Set Security Protocols for Your Messaging for Web Deployment](https://help.salesforce.com/s/articleView?id=service.miaw_security.htm&release=264.0.0&type=5 "To successfully use Messaging for Web, add your experience site or external website domain to a Cross-Origin Resource Sharing (CORS) allowlist. If you change your domain, remember to update the CORS allowlist.")
- [Manage Site Membership](https://help.salesforce.com/s/articleView?id=platform.exp_cloud_administer_members.htm&type=5&language=en_US)