Persisting User Session on Chrome Extensions

Skip to first unread message

Ivan Chen

Apr 19, 2024, 3:54:57 PMApr 19
to Chromium Extensions
Hello I am currently developing an extension with user authentication provided by supabase. I would like to persist the user's login whenever the user authenticates themself, however, once they log in and click out of the extension, it automatically brings the user to the initial popup. I tried using the chrome storage API to store the user's session however it still brings the user back to the initial page when clicking out of the extension. Any advice would be greatly appreciated!


Apr 19, 2024, 9:57:50 PMApr 19
to Chromium Extensions, Ivan Chen
Sounds like you use an action popup and it closes after using the sign-in UI. It means the page is completely destroyed just like it does when closing a tab. Next time you open the popup it runs again from the beginning using the same html page that you previously configured in manifest.json or via chrome.action API. Use chrome.action.setPopup to change the page displayed when the popup is opened next time. To change the currently displayed page in a visible popup additionally use location.replace() inside the popup.
Reply all
Reply to author
0 new messages