We are using the community portal in our Salesforce org. Our homepage features an LWC (Lightning Web Component) with both a Login button and a Logout button. Here’s the behavior we want to achieve:

When the user is not logged in, only the Login button should be displayed. When the user is logged in, only the Logout button should be shown. For example, if a user clicks “Log in as experience user” from the contact record, we want the Logout button to be visible.

Could someone please guide us on how to catch this event in an LWC Component?

Thank you in advance for your assistance! 😊


You must log in to answer this question.