Reputation: 10364
Is there a way for Firebase Authentication to work in an open sourced app without requiring an SHA-1
key?
I've open sourced the Android code for Coinverse, the first cryptocurrency news app for audiocasts on-the-go, in order to share Android best practices and architecture. The goal is for the developer to run the de-compiled app from Android Studio and login.
I've done the following for Firestore Database, Storage, YouTube API, and etc. to work as expected for developers downloading the project from GitHub:
Upvotes: 3
Views: 306
Reputation: 10364
Strategy - Create both an open source shared Firebase instance to provide access to shared data and Cloud Functions, and have developers who download the GitHub project create their own private Firebase instance for authentication used as the default instance via the google-services.json file.
Pro-tip - Be sure to identify a unique SHA-1
key with each Firebase project that requires it, otherwise there'll be an authentication error outlined here.
FirebaseApp.getInstance("openSourceProject")
Note: setProjectId(...)
also needs to be set for the FirebaseOptions
although not mentioned in the link above and any other setters for services used such as Storage.FirebaseFirestore.getInstance(FirebaseApp.getInstance("openSourceProject"))
FirebaseStorage.getInstance(FirebaseApp.getInstance("openSourceProject"))
and FirebaseFunctions.getInstance(FirebaseApp.getInstance("openSourceProject"))
SHA-1
keyFirebaseFirestore.getInstance()
Upvotes: 1