r/FlutterDev • u/DohamaSystems • Oct 26 '26
Discussion added a "try without account" button with supabase anonymous sign in, way easier than I thought
wanted people to be able to try my flutter app without signing up. First idea was one shared demo account but then everyone sees everyone elses chats, not great lol
turns out supabase has anonymous sign in. You turn it on in the auth settings and then it's literally just
await Supabase.instance.client.auth.signInAnonymously();
every visitor gets their own real user with its own id. So all my existing rls policies just work, every guest only sees their own stuff. Didn't have to change anything in the db
one thing good to know: anon users get the normal authenticated role. So if you have stuff that only real accounts should do, you gotta check the is_anonymous claim in the jwt, otherwise guests can do it too
also put a daily limit per user on the AI calls since guests cost me money and theres no email behind them
I'm keeping the guest accounts for now, kinda nice to see how many ppl actually tried it. Does anyone convert them to real accounts later (linking an email to the anon user) or do you just let people start fresh when they sign up?
2
u/MobileXapps Oct 26 '26
Linking is worth it. You can call updateUser with an email (or linkIdentity for Google/Apple) on the anonymous session, and the user keeps the same id, so their rows and your RLS just carry over. Starting fresh means people lose what they did as a guest, which is usually the reason they decided to sign up.
The case to handle is when that email already has an account. Then linking fails, and you either sign them into the old account and move the guest rows yourself, or tell them the guest data stays behind.
Also worth turning on captcha for anonymous sign-ins and cleaning up old anon users with a scheduled job. They pile up fast and each one is a real row in auth.users.
2
u/Cozy_Creamy Oct 27 '26
Nice to know about this, I used to offer a guest mode that had no contact to supabase, only local storage until you register, then later I removed entirely and made it mandatory to register.
2
u/bramantec Oct 28 '26
I went the other way: there are no guest accounts at all. Someone who gets an invite link opens a web page and a server function returns only the few fields needed for the preview, like the title, the place, the time and how many are going. To confirm they need the app and a phone account, and a blocking function on sign up rejects every other provider, anonymous included. So nothing piles up in auth and there is nothing to convert. The cost is that a guest can look but can't do anything, and I don't know yet how many people stop at that step.