Custom Logout Button on Lightning Component in Community

Screen Shot 2016-02-24 at 11.30.11 AM

If you want to create your own logout button for a Community Lightning Component, you can use the window.location.replace() javascript function.

The button component (note: this example is the button only, you would typically include this in a Notification):

<aura:component implements="forceCommunity:availableForAllPageTypes" 
    <ui:button label="Logout" press="{!c.logout}"/>

And in your controller, you can redirect the user to the logout page:

    logout : function(component, event, helper) {

Just replace “YourCommunityDomain” with whatever the base URL is for your community.  Typically something like “”.  This will redirect the user to the standard logout page for your community.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s