You need to sign in to do that
Don't have an account?
Chuck Ramsey
How do I implement logout in a custom User Profile Menu?
Salesforce uses a URL like "https://mycommunity/secur/logout.jsp?retUrl=https%3A%2F%2fmycommunityurl%2FCommunitiesLanding". If I use the force:navigateToUrl event with a similar URL, navigateToUrl sees the address as an absolute URL and always opens it in a new tab/window; the tab from which I click the Logout option in my User Profile Menu remains open and usable. Salesforce says that window.location won't work in Lightning and my experience supports that assertion. How does the User Profile Menu component supplied with Napili implement logout?
I know I've got the composition of the URL correct -- if I enter the URL in my browser I get the expected behavior:
I know I've got the composition of the URL correct -- if I enter the URL in my browser I get the expected behavior:
- If I'm logged in to the community as myself, I get logged out and returned to the login page.
- If I'm logged in as an extranl (customer) user, I get sent back to the Contact page for that user.
logout.fire();