Bubble.io: Accessing Local Storage plugin from Reusable Header to Log Out a user

Options
I use Xano as my backend and Bubble as my frontend. Based on Michael's videos, I also use the Local Storage Bubble plugin. I'm stuck on logging out and have a question:

I've created a reusable Header in Bubble to hold all my navigation controls so that I only need to make changes to the header in one place and have it reflected throughout my app. To log out, I want to delete the authToken stored in the Local Storage plugin. 

However, it appears I can only access the Local Storage plugin from within a page (where I have placed a plugin) but not from the Reusable Header. This means that I can't place the logout button in the reusable header unless I manually copy and paste copies of the header on every page. 
1.  Here's the reusable header with the logout button[logoutButton_1.png]2. Local Storage options don't show up when I activate the workflow for the Logout button in the Reusable header.[workflowFromReusableHeader_2.png]3. However, when I use a Logout button placed on the actual Bubble page, I see the options to delete Local Storage value. However, it's not efficient to create multiple Logout buttons on each app page.[workflowFromPageHeader_3.png]I would prefer to have the logout button in the reusable page header since that feels natural. Moreover, if it's not in a reusable header, then anytime I have to make a change to the header, it means I have to go back to all the app pages to update the change. Is there a workaround for this?

Comments

  • Michael Udinski
    Michael Udinski Administrator

    ADMIN

    Options
    You could do the Clear a Local Storage when you land on the page the log out takes you perhaps - or maybe put the local storage plugin in the header so it's accessible in the workflow there
  • Eben
    Eben Member
    Options
    Thank you so much, Michael!! Placing the local storage plugin in the header and clearing it (instead of deleting it) in the workflows solved the problem.