Migrate Rails Devise Users to Firebase Authentication
My goal for my SaaS gixtra.com (a tool to book and organize concerts) is to delegate as many non-core-business features to external services, so I can focus on the important music business stuff. One milestone to reach this goal is to get rid of doing authentication myself in Devise. Since I find Google’s Firebase offering very appealing, I want to migrate my existing users to Firebase Authentication. Here is how I did it…
Getting started
This is basic Firebase setup stuff, so I will spare you the details.
First I created a new project in Firebase and enabled email authentication. Then I initialized my Rails app, connected it to the newly created Firebase project and chose to use just the Firebase database service.
Now comes the interesting part…
Importing in 2 steps
Importing your Devise users into Firebase Auth essentially takes 2 steps:
- Export your user data into an appropriately formatted JSON file
- Import that file via the Firebase CLI
1. Exporting Devise users to JSON
First we need to export our users into a JSON file, which will later be picked up by Firebase in the second…