Firebase database not working with Facebook Expo authentication

I’ve been developing an app with React Native (with Expo) and Firebase on the backend. When running the project through Expo client on the iPhone, I can normally login with email and password and then fetch data from Firebase database. But when I login with Facebook, database read hands and it does not resolve anything. Important parts of the code look following:


// This works everywhere
export const login = async (email, password) => {
    await firebase.auth().signInWithEmailAndPassword(email, password);

    const userId = firebase.auth().currentUser.uid;

    return userId + '';

export const loginByFacebook = async () => {
  const { type, token } = await Expo.Facebook.logInWithReadPermissionsAsync(FB_APP_ID, {
    permissions: ['public_profile'],

  if (type === 'success') {
    const credential = firebase.auth.FacebookAuthProvider.credential(token);

    try {
      await firebase.auth().signInAndRetrieveDataWithCredential(credential);
    } catch (error) {
      console.log('cannot login ', error);

export const readData = (key) => {
  console.log('getWins ');
  const userId = firebase.auth().currentUser.uid;

  return firebase


class PostList extends React.Component {
    async componentDidMount() {
        // it normally resolves when logged with email & password,
        // resolves with facebook auth on iPhone simulator
        // does not resolve with facebook auth on Expo client on iPhone
        const data = await readData('posts');

However, what is really strange, that it does not work on iPhone + Expo client, but does on the iPhone simulator. The crucial part is in the async componentDidMount().

Database config is still in the dev mode (allow all read & writes):

    "rules": {
        ".read": true,
        ".write": true

I’ve used the following guides:

Are there any more prerequisites that I’ve forgotten to setup? Or Expo client has limitations in terms of properly handling calls with Facebook auth? Thanks!

Have you set up the settings on Firebase and Facebook consoles as outlined in

Also – this seems to use an OAuth redirect – maybe would be helpful?

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.