React native google sign in Error: A non recoverable sign in failure occured

Viewed 143

I built 2 different views for tabs and mobile devices in the same component and the google login works fine on the tab emulator but whenever I run it on the mobile it brings "A non-recoverable sign in failure occurred" and "Undefined is not an object (_evaluating '_await$GoogleSignin$s.idToken')]

//This is the function that calls the sign in
 async function onGoogleButtonPress() {    
setViewloader(true)
try {
  // Get the users ID token
  const { idToken } = await GoogleSignin.signIn().catch(err=>console.log(err));      
  
  // Create a Google credential with the token
  const googleCredential = auth.GoogleAuthProvider.credential(idToken);

  // Sign-in the user with the credential      
  return auth().signInWithCredential(googleCredential);
} catch (error) {
  console.log(error)
  setViewloader(false)
 }
}

//These two below initialize the app upon startup
let firebaseConfig = {

apiKey: "****",
authDomain: "****",
databaseURL: "****",
projectId: "*****",
storageBucket: "******",
messagingSenderId: "*****",    
appId: "******",    
};

if (firebase.apps.length === 0) {
  firebase.initializeApp(firebaseConfig)      
    .catch(err => console.log(err))
}    

//NB: It works on the tab emulator but brings this error on the mobile emulator
0 Answers
Related