Sign in
Log inSign up
Ákos Kőműves

12 comments

Emmanuel Uzoezie
Emmanuel Uzoezie
Dec 6, 2022

Supabase is what I want to get soon, the article will help a lot, thanks for sharing this. Looking forward to learn from it.

1
·
·1 reply
Ákos Kőműves
Ákos Kőműves
Author
·Dec 6, 2022

Happy to hear this Emmanuel, Supabase is great!

·
Richard Bankole
Richard Bankole
Jan 10, 2023

Hi Ákos, thanks for posting this guide!

I wanted to check out the repo directly, but I'm getting a 404 error - can you please share an updated link?

1
·
·1 reply
Ákos Kőműves
Ákos Kőműves
Author
·Jan 11, 2023

The repo was set to private 🙈 Thanks Richard Bankole

·
Jahan
Jahan
Feb 28, 2024

Thanks Ákos Kőműves for the clean and easy to follow post explaining how to use Supabase, appreciate it! 🙏🏼

1
·
·1 reply
Ákos Kőműves
Ákos Kőműves
Author
·Feb 29, 2024

You're welcome Jahan, glad you found it helpful! 🙂

1
·
Alex Smotritsky
Alex Smotritsky
Aug 15, 2024

You mentioned a possible CRUD tutorial. I'm trying to do CRUD against supabase from my browser extension so if you could put out such a tutorial that would be great. I just put the supabase client import at the top of my popup.js file and got an error. Apparently my popup.js file is not a module and I can't put an import at the top of it. D'oh!

1
·
·1 reply
Ákos Kőműves
Ákos Kőműves
Author
·Aug 15, 2024

You might want to send whatever data you want to save in your popup.js to your backend and attempt a save from there. Yesterday, I also published my second book, which is about PWA development with React and Supabase. I'm also doing CRUD operations and setting up Supabase from scratch for crud. I currently have an ongoing promotion, and you can get the book for free. If you're interested, just send an email to .

1
·
Emre Demirel
Emre Demirel
Jan 3, 2023

I don't understand how did you handle the session management here. You are using getSession() method from supabase js on your background script but it can't turn anything because supabase can't initialize session on your extension on the background script.

I am using oauth client to login with my background script. I can login but I can't use any other method because supabase can't set session data to chrome.storage.local

Even tho, I explicitly refreshSession on my background script, it returns the new session but doesn't add anywhere. So it disappears in the first browser refresh. How do you keep the extension session live inside your background script? I ask this because there is no info for cross-tab session management inside extensions anywhere in the internet :)

Just because I don't have valid session stored anywhere in my background script, I can't use RLS with supabase-js. Also just because I can't use RLS I can't share my anon_key. Any ideas/opinions on this?

·
·3 replies
Ákos Kőműves
Ákos Kőműves
Author
·Jan 4, 2023

I don't understand how did you handle the session management here. You are using getSession() method from supabase js on your background script but it can't turn anything because supabase can't initialize session on your extension on the background script.

getSession() returns the existing session that's persisted in localStorage after a successful await supabase.auth.signInWithPassword(value); call.

·
Emre Demirel
Emre Demirel
Jan 4, 2023

Ákos Kőműves I know that but here's the problem. localStorage is domain based. So when you switch to different tab for different website, your extension won't persist the session. There has to be an extension wide solution which is only (as far as i imagine) possible with chrome.storage.local

Also, since you can't utilize localStorage, your background script can't use it for JS sdk. Service workers have their own runtime outside of window. If we want to have RLS active and use the database features, it's not possible extension-wide with the current session mechanism.

I wonder how you would solve those problems? I ask because mainly those are the problems that I am trying to solve but there is no proper information anywhere in the internet :)

·
Ákos Kőműves
Ákos Kőműves
Author
·Jan 4, 2023

Emre Demirel this extension is designed to work on blank.org or whatever page you specify in the manifest file.

My other extension tweton.com works only on twitter.com.

I haven't built any extensions that retain data between websites, although it would be possible with chrome.storage.local, it wouldn't work with Firefox.

Luckily supabase's createClient function accepts a 3rd argument where you can specify a custom storage mechanism.

It accepts an object with getItem, setItem, and removeItem.

supabase.com/docs/reference/javascript/ini…

Hope this helps.

·