Updating existing T3 with Supabase Auth from Next Auth
Background:
- Launched a T3 app with Next Auth.
- Currently got 3000 users.
- Launching an app version (expo), so migrating T3 app to T3-turbo.
- Upgrading Next-Auth to Supabase Auth to work with React Native, want to keep existing users and ease migration.
- Supabase generates an auth.users table.
I'm looking to guidance that I'm on the right track with my implementation.
1. I've added a new field to my existing Users table called SupabaseId. This will be the reference for Supabase Auth and my Users table. (Usually both id's would be the same.).
2. Created a webhook from Supabase when a new user is created in Supabase Auth (Signs up,in). The webhook hits an API to create a new user in the Users table of my DB and added the Supabase ID.
3. The new TRPC context. This bit feels abit hairy. I'm having to extend the supabase user and lookup the user from my DB on each request to add in the users ID and role.
Overall wondering if this approach is the correct one? My db id's are all cuid's and kind of wish I just started the uuid's and they seem much more used in industry.
Thanks
2 Replies
Hi,
I'm also building a web app and will need to build a react-native app later on. Would you recommend starting out with supabase auth straight away as it integrates into both?
Also, have you looked at solito.dev?
Hello! Seeing the current context, he’s looking for answers himself. It feels burdensome to ask a question to him while he’s looking for help himself . I suggest you create a new post. This way you can get answers from anyone who’s looking