Firebase中令人困惑的Auth域设置 [英] Confusing Auth domain setting in Firebase
问题描述
在Firebase应用中似乎可以在多个地方设置auth域.
There seem to be multiple places to set the auth domain in a Firebase app.
-
Firebase控制台>身份验证>登录方法>身份验证域
Firebase console > Authentication > Sign in methods > Auth domains
AuthDomain属性
AuthDomain property of the Firebase config object
developers.google.com>凭据> API密钥>密钥限制
developers.google.com > Credentials > API Keys > Key restriction
在生产应用中,我们是否必须在所有这些地方设置身份验证域?在这些不同位置设置的auth域实际上有不同的用途吗?
In a production app, do we have to set auth domain in all these places? Does the setting of auth domain in these different places actually have different purposes?
推荐答案
Firebase控制台>身份验证>登录方法>身份验证域
Firebase console > Authentication > Sign in methods > Auth domains
此代码用于在您的项目中使用Firebase身份验证.
This one is used to be able to use Firebase-authentication in your project.
Firebase身份验证提供后端服务,易于使用的SDK和现成的UI库,以对您的应用程序的用户进行身份验证.它支持使用密码,电话号码,流行的联合身份提供商(例如Google,Facebook和Twitter等)进行身份验证.
Firebase Authentication provides backend services, easy-to-use SDKs, and ready-made UI libraries to authenticate users to your app. It supports authentication using passwords, phone numbers, popular federated identity providers like Google, Facebook and Twitter, and more.
此处的更多信息: https://firebase.google.com/docs/auth/
Firebase配置对象的AuthDomain属性
AuthDomain property of the Firebase config object
初始化代码时使用此代码:
this one is used when initializing your code:
var config = {
apiKey: "<API_KEY>",
authDomain: "<PROJECT_ID>.firebaseapp.com",
databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
storageBucket: "<BUCKET>.appspot.com",
messagingSenderId: "<SENDER_ID>",
};
此处有更多信息: https://firebase.google.com/docs/web/setup
developers.google.com>凭据> API密钥>密钥限制
developers.google.com > Credentials > API Keys > Key restriction
此密钥用于生成API密钥,您将在项目中使用该密钥并将其添加到上面的代码中.
This one is used to generate the API key, that you will use in your project and add it in the code above.
可能需要全部三个,但是所有三个都有不同的用途.
All 3 can be needed, but all 3 have different purposes.
这篇关于Firebase中令人困惑的Auth域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!