我正在使用firebase为我的ReactJS应用程序创建一个登录页面
auth
包裹。
我已经进口了
认证
我的全局firebase文件中的包:
import firebase from 'firebase/app';
import 'firebase/firestore';
import 'firebase/auth';
const config = {
apiKey: "xxx",
authDomain: "xxx",
databaseURL: "xxx",
projectId: "xxx",
storageBucket: "xxx",
messagingSenderId: "xxx"
};
export default firebase.initializeApp(config);
现在在我的
LoginComponent
我要去上课
FacebookAuthProvider
它是
firebase.auth
命名空间。
为了访问这个类,我导入
认证
命名空间。
import React, { Component } from 'react';
import { auth } from 'firebase';
class Login extends Component {
provider = new auth.FacebookAuthProvider();
由于上一次导入,我在控制台中收到以下警告:
It looks like you're using the development build of the Firebase JS SDK.
When deploying Firebase apps to production, it is advisable to only import
the individual SDK components you intend to use.
For the module builds, these are available in the following manner
(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):
CommonJS Modules:
const firebase = require('firebase/app');
require('firebase/<PACKAGE>');
ES Modules:
import firebase from 'firebase/app';
import 'firebase/<PACKAGE>';
在查阅了这么多文档和代码之后,我仍然无法找出如何在访问
FacebookAuthProvider
上课。
第二个问题:我现在真的在使用完整的firebase开发SDK吗?我只进口了
认证
命名空间,对吧??