Pasan Rooparathne
Pasan Rooparathne

Reputation: 1

Can't find variable: Expo

I am making an app with react native. It has login with facebook option, it keeps giving me this error. "Facebook Login Error: Can't find variable: Expo" What am I doing wrong here?

Do I have to install some dependencies on Linux

f.auth().onAuthStateChanged(function(user) {
  if(user){
    //logged in
    console.log('Logged in', user);
  }else {
    //logged out
    console.log('logged out');
  }
});



const { type, token} = await Expo.Facebook.logInWithReadPermissionsAsync(
  'APP_ID',
  { permissions: ['email', 'public_profile'] }
);

if(type === 'success'){
  const credential = firebase.auth.FacebookAuthProvider.credential(token);
    firebase.auth().signInWithCredential(credential).catch((error) => {
    console.log('Error...',error);
  })
}








Possible Unhandled Promise Rejection (id:0): ReferenceError: Can't find variable: Expo loginWithFacebook$

Upvotes: 0

Views: 4155

Answers (2)

Equan Ur Rehman
Equan Ur Rehman

Reputation: 269

Assuming you have included Facebook SDK as following

import * as Facebook from 'expo-facebook';

You shouldn't be redundantly calling Expo.Facbook but instead try

const { type, token} = await Facebook.logInWithReadPermissionsAsync...

Upvotes: 1

Zeeshan Ansari
Zeeshan Ansari

Reputation: 10808

You have forgot to import Expo

import Expo from 'expo';

But you should use expo-facebook module for facebook login for more information please read document here https://docs.expo.io/versions/latest/sdk/facebook/

Upvotes: 0

Related Questions