Google如何在本机项目中使用Fire-base进行身份验证?

时间:2019-05-17 12:09:42

标签: reactjs react-native firebase-authentication react-native-android react-native-ios

我正在使用Social Auth!插件以使用Firebase与google登录,并且按照文档执行了所有步骤。 我的代码是:

import { GoogleSignin } from 'react-native-google-signin';
import firebase from 'react-native-firebase'



export async function googleLogin() {
  try {
    // add any configuration settings here:
    await GoogleSignin.configure();

    const data = await GoogleSignin.signIn();

    // create a new firebase credential with the token
    const credential = firebase.auth.GoogleAuthProvider.credential(data.idToken, data.accessToken)
    // login with credential
    const firebaseUserCredential = await firebase.auth().signInWithCredential(credential);

    console.warn(JSON.stringify(firebaseUserCredential.user.toJSON()));
  } catch (e) {
    console.error(e);
  }
}

当我在android设备上运行应用程序时, react native调试器向我显示此错误:

Uncaught (in promise) TypeError: Cannot read property 'concat' of undefined
    at DeltaPatcher.applyDelta (DeltaPatcher.js:77)
    at deltaUrlToBlobUrl (deltaUrlToBlobUrl.js:28)

如果我做错了事,请告诉我。或react-native插件有问题

0 个答案:

没有答案