Expo Facebook Auth Is Working on Expo App, But Not With TestFlight


#1

Hi there!
I am making my first app (!) and use Expo Facebook Auth (Expo.Facebook.logInWithReadPermissionsAsync) to enable a user sign in or sign up using their Facebook account.

It is working well when I tested my app on iOS Expo App. Once I press a button related with Facebook sign in, a new view shows up, and I can enter Facebook id and password. After finishing it, I receive the token from them, and it is used for Firebase authentication.

The problem is that when I try my app with TestFlight, nothing shows up. After I googled about it, I noticed that it was a common issue in the past, but I did not find recent one, so I am wondering why it happens.

Environment:
Expo CLI 2.6.5 environment info:
System:
OS: macOS High Sierra 10.13.6
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.10.0 - /usr/local/bin/node
Yarn: 1.9.4 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Xcode: 10.1/10B61 - /usr/bin/xcodebuild
npmPackages:
expo: ^30.0.1 => 30.0.1
react: 16.3.1 => 16.3.1
react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4
react-navigation: ^2.16.0 => 2.16.0
npmGlobalPackages:
expo-cli: 2.6.5

Related Codes:

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

	if (type === 'success') {
		const credential = firebase.auth.FacebookAuthProvider.credential(token);
		firebase.auth().signInAndRetrieveDataWithCredential(credential)
		.then((user) => {
			// some codes
		}).catch((err) => {
			// somecodes
		})
	}

#2

Hey @yoojs0525,

Excited you are building your first app! Just to play it on the safe side, can you make sure you have configured your app.json and Facebook Developer settings as mentioned here: https://docs.expo.io/versions/v31.0.0/sdk/facebook#registering-your-app-with-facebook

If you have, this could be a bug in which case could you share your app.json contents?

Cheers,

Adam


#3

Hi Adam. Thanks for your reply. My app.json is as follows:

{
  "expo": {
    "name": "App name",
    "description": "App Description",
    "slug": "slug",
    "privacy": "public",
    "sdkVersion": "30.0.0",
    "platforms": ["ios", "android"],
    "version": "0.2.4",
    "facebookScheme": "fb1234567", // FacebookID in string started by fb that I found on Facebook website (https://developers.facebook.com/docs/facebook-login/ios)
    "facebookAppId": "1234567", // FacebookID in string that I found on Facebook website (https://developers.facebook.com/docs/facebook-login/ios)
    "facebookDisplayName": "AppName", // The app name I use for Facebook auth
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#e7ebd4"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "bundleID"
    }
  }
}

I know that there is a new version of Expo (v31) is available, and I consider updating it from v30 to v31 if this issue can be solved. Do you think it might be a bug for v30?

Thanks,
James


#4

Same problem here ( sdk v30 )
Everything works on development mode on Expo but on Standalone Version only
Android login with facebook works as expected,
on IOS pushing button doesn’t do anything,
after catching error’s from logInWithReadPermissionsAsync function i get this


But that error doesn’t really say aything …
Weird thing is that build from ~6 days ago worked as expected and i could log in with facebook
without any problem on android and ios.

Sorry for posting in this thread but i didn’t want to create new one seeing that we might have the same problem.

Thanks.

Edit: Adding app.json file

{
  "expo": {
    "name": "myAppName",
    "description": "",
    "slug": "myAppName",
    "privacy": "unlisted",
    "sdkVersion": "30.0.0",
    "facebookAppId":"myFacebookAppId",
    "facebookScheme":"myFacebookScheme",
    "facebookDisplayName":"myFacebookDisplayName",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.0.0",
    "orientation": "portrait",
    "icon": "./assets/images/icon.png",
    "splash": {
      "image": "./assets/images/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#000000"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": false,
      "bundleIdentifier": "com.myName.myName",
      "config": {
        "googleSignIn": {
          "reservedClientId": "myGoogleClientId"
        }
      }
    },
    "android": {
      "package": "com.myName.myName",
      "config": {
        "googleSignIn": {
          "apiKey":"googleApiIDKey",
          "certificateHash":"myCertHash"
        }
      } 
    }
  }
}

#5

Hi @ravixini

I think adding more in this thread would be a great idea to have more attention from Expo team. I did not know that it works on Android. It looks like it is an iOS-related issue then.


#6

Hey @yoojs0525 and @ravixini,

This certainly has the signs of being a bug. Do you think one of you could create a github issue here: https://github.com/expo/expo/issues with all the relevant information you can provide. Whomever makes it, the other can add their information to the issue as well! Sorry about the bug!

Cheers,

Adam


#7

I think I’m running into the same issue. Facebook auth works from Expo but when I generate an app and send it to Apple, the Test Flight version of the app doesn’t work. Oddly enough, it doesn’t work on my iPhone XS or my iPhone 8, but it does work properly on my iPhone 5s and iPhone SE with iOS 12.1.1.

I get right up to

let { type, token } = await Facebook.logInWithReadPermissionsAsync('[App ID Removed]', {
    permissions: ['public_profile', 'email']
})

And that’s where the code stops running on the 8 and XS. But again, runs just fine on an iPhone 5s and SE after downloading from Test Flight.


#8

@adamjnav @ravixini @freehunter
Hi all. After upgrading to Expo v31, the problem is solved. To make sure, I deployed the app without changing any code, and installed it through TestFlight. As expected, a view is appeared after pressing the button which executes a function for Facebook Auth, and I could enter email address and password. Token was given afterwards. For a person who has encountered the same situation, I think upgrading to v31 would be an option.


#9

I can also confirm SDK 31 works with the “system” behaviour option. I did have trouble with “browser” though.


#10

Hey all,

Thanks for the update. We are aware of the bug and can also confirm/suggest upgrading to SDK31 if possible.

Cheers,

Adam


closed #11

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