Expo: “auth/operation-not-supported-in-this-enviroment”

前端 未结 2 1328
心在旅途
心在旅途 2021-01-19 20:23

I develop a react-native (expo) mobile app and try to sign in with a google account to firebase, but I get an error:

\"auth/operation-not-supported-in

2条回答
  •  清酒与你
    2021-01-19 21:18

    signInWithPopup is not supported in react-native. You will need to use a third party OAuth library to get the OAuth ID token or access token and then sign in with Firebase:

    const cred = firebase.auth.GoogleAuthProvider.credential(googleIdToken, googleAccessToken);
    firebase.auth().signInWithCredential(cred)
      .then((result) => {
        // User signed in.
      })
      .catch((error) => {
        // Error occurred.
      });
    

提交回复
热议问题