[英]Facebook Auth and Firebase - How to add 4 apps under same Facebook app?
假设我有4个应用程序,iOS和Android的“Uber Clone”以及iOS和Android的“Uber Driver Clone”。 我为所有4个使用相同的Firebase项目,因为它们共享相同的数据库。
说到Facebook Auth,我只能向Firebase添加一个Facebook应用程序。 对于每个Facebook应用程序,我只能添加一个iOS和一个Android应用程序。 因此,我该如何使这项工作?
Firebasers,还有任何建议/解决方案吗?
允许单个Facebook应用程序连接到多个iOS应用程序和多个Android应用程序。 对于iOS应用程序,您可以在Facebook App设置页面指定多个Bundle ID
。
假设您使用Firebase进行身份验证,我认为您使用实时数据库或Cloud Firestore来存储用户数据。 在用户数据模型中,您可以添加用户类型。
例如,
user_type : "driver"
然后像这样查询用户:
DBreference.collection("users").whereField("user_type", isEqualTo: "driver").getDocuments() {(querySnapshot, error) in
if error != nil { print(error.debugDescription)
return
}
else if let users = querySnapshot.documents {
for user in users {
guard let userType = user.data()["user_type"] as? String else { return }
print(userType)
}
}
}
这样您就不必创建多个Facebook应用程序。 只需使用您拥有的那个,并相应地细分用户及其权限。 例如,在两个应用程序上登录时,请检查用户是否尝试以驾驶员或乘客身份登录。
if currentUser.userType != "passenger" {
print("You can't log into the passanger app with your driver's account.")
}
希望这可以帮助。
此时,似乎无法在单个Firebase实时数据库下拥有多个FB应用程序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.