Newer Version Available

This content describes an older version of this product. View Latest

Create a Logout Link Component

To log out your users, you can create a custom logout link component.

See examples for a logout link and profile menu in codeSamples/salesforceScopedModules/force-app/main/default/ in the code sample files.

Tip

To log out your users, redirect them to the [/sitePrefix]/secure/logout.jsp path where [/sitePrefix] is your site’s base path (without the /s). If your site doesn’t use a prefix, use an empty string.

Here’s an example of a component that only displays the logout link when a user is authenticated.

Alternatively, you can make calls to the provided system Apex classes to get the login and logout links.

By default, users are redirected to the login page after logging out. You can configure the logout page URL in Experience Workspaces under Administration | Login & Registration | Logout Page URL.