Switch from Firebase auth to Supabase auth, the open-source Firebase alternative
If you’re using Firebase as a authentication service for your application and you’re considering moving over to Supabase, the open-source alternative, this guide helps you walk through the migration.
This guide assumes you’re already familiar with Firebase and basic concepts of it. To begin with, we will need to retrieve few resources:
Anon public key. This can be found under your Supabase project’s settings, under the API section.
Database URL. This can be found on the same page as your anon public key.
Supabase JavaScript client. You will need the latest version of JavaScript client for Supabase. You can install it with npm:
npm install @supabase/supabase-js
Then import it to your application in place of your `firebase.initializeApp(firebaseConfig);`
import { createClient } from ‘@supabase/supabase-js’
// Create a single supabase client for interacting with your database const supabase = createClient(‘https://xyzcompany.supabase.co’, ‘public-anon-key’)
👏 Now you’ve added Supabase to your application!
Authentication in Supabase vs Firebase
Here is a breakdown of how authentication functions differ between the two services.
Create new users
Log in to existing user
Get the current user
Receive a notification every time an auth event happens
That’s it! Now you’ve migrated from Firebase authentication to Supabase.
For further reading, you can refer to Supabase.io/docs
Thank you!