Firebase身份验证-开放源Android应用 [英] Firebase Authentication - Open Sourcing Android App

查看:120
本文介绍了Firebase身份验证-开放源Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 Firebase身份验证在开源应用中而不需要SHA-1键?

Is there a way for Firebase Authentication to work in an open sourced app without requiring an SHA-1 key?

我已经为 Android代码 .google.com/store/apps/details?id = app.coinverse"rel =" nofollow noreferrer> Coinverse ,这是第一个用于在旅途中进行音频广播的加密货币新闻应用程序,目的是分享Android最佳做法和建筑.开发人员的目标是从Android Studio运行反编译的应用程序并登录.

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.

对于Firestore数据库,存储,YouTube API等,我已经完成了以下工作,以使开发人员能够从GitHub下载项目:

I've done the following for Firestore Database, Storage, YouTube API, and etc. to work as expected for developers downloading the project from GitHub:

  • New open source Firebase project
  • New API keys
  • Firestore database budget limit
  • Firestore Security Firestore and Storage rules

推荐答案

共享和私有Firebase实例

策略-创建一个开源 共享 Firebase实例,以提供对共享数据和Cloud Functions的访问权限,并让开发人员下载GitHub项目通过 google-services.json 文件创建了自己的 private Firebase实例作为身份验证的默认实例.

Shared and Private Firebase Instances

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.

专业提示-请确保为每个需要它的Firebase项目标识一个唯一的SHA-1密钥,否则会出现身份验证错误

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.

  • 使用使用来初始化共享的开源 Firebase项目.您的应用中有多个项目以编程方式实施(将用于发布的非共享 staging production 项目从单独的项目中分离出来). -FirebaseApp.getInstance("openSourceProject") 注意:setProjectId(...)还需要为FirebaseOptions设置,尽管在上面的链接中以及用于存储等服务的其他设置器中未提及.
  • 使用共享的Firestore项目中的公共内容和价格数据填充应用程序-FirebaseFirestore.getInstance(FirebaseApp.getInstance("openSourceProject"))
  • 使用共享的Cloud Functions和Firebase存储从存储 .txt 文件创建 .mp3 文件,并从存储访问 .mp3 . -FirebaseStorage.getInstance(FirebaseApp.getInstance("openSourceProject"))FirebaseFunctions.getInstance(FirebaseApp.getInstance("openSourceProject"))
  • Initialize the shared open source Firebase project with the Use multiple projects in your application programmatic implementation (separate project from the non-shared staging and production projects used for releases). - 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.
  • Populate app with public content and price data from shared Firestore project - FirebaseFirestore.getInstance(FirebaseApp.getInstance("openSourceProject"))
  • Use shared Cloud Functions and Firebase Storage to create .mp3 files from Storage .txt files and access .mp3s from Storage. - FirebaseStorage.getInstance(FirebaseApp.getInstance("openSourceProject")) and FirebaseFunctions.getInstance(FirebaseApp.getInstance("openSourceProject"))
  • 通过 google-services.json 文件初始化为默认的Firebase项目实例.
  • 用于使用其SHA-1键进行身份验证
  • 将登录的用户数据保存到其Firestore实例-FirebaseFirestore.getInstance()
  • 删除用户功能
  • Initialized as default Firebase project instance via the google-services.json file.
  • Use for authentication with their SHA-1 key
  • Save logged in user data to their Firestore instance - FirebaseFirestore.getInstance()
  • Create a Firebase token for delete user functionality

这篇关于Firebase身份验证-开放源Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆