Facebook login example doesn't work with Create React Native App CRNA

Using the example from: https://docs.expo.io/versions/v19.0.0/sdk/facebook.html

async function logIn() {
  const { type, token } = await Expo.Facebook.logInWithReadPermissionsAsync('<APP_ID>', {
      permissions: ['public_profile'],
  if (type === 'success') {
    // Get the user's name using Facebook's Graph API
    const response = await fetch(
      'Logged in!',
      `Hi ${(await response.json()).name}!`,

Firstly it won’t run with the “function” keyword included. Secondly it brings the error:

Not Logged In: You are not logged in. Please login and try again.

I have my facebook app ID inserted. I am using a button to trigger this.

hello! I don’t really know what is happening in your code outside of that, but the same code you give above works as expected in this example: https://snack.expo.io/rJDqQEWOZ

1 Like

I am using a fresh install of the create react native app. Have you tried it there?

can you share the full code?

fwiw, it’s the same environment in snack as in create-react-native-app. just to rule out any possibility i tried the code in the example snack i shared in a new crna app and it worked as expected

Error could be on the facebook side. Make sure all the settings are configured properly.

I tried the your app ID in a fresh install and it works. My app ID: 688129461275981, gives the error “Not Logged In: You are not logged in. Please login and try again.” I have used my app for facebook login on several applications. Is there a different setting? If the user cannot login because they have already logged into their account from another app I don’t see how that’s helpful either. Please feel free to try it with my app ID.

Brent’s snack is working with the ID you provided, hopefully it’s resolved for you locally as well?

It’s giving me that error on the expo app on my phone, which is where I want it to work. If anyone can get it working on it their phone I would like to know.

Have you been changing anything on your end? I don’t believe there are any changes we’ve made that would be affecting this.

I tested both your key and brent’s on device through snack earlier, and they worked fine.
When you wrote back, I tried through xdl and that failed, but now both of the snack tests I tried earlier are failing too.

I’m looking at this stack overflow answer: https://stackoverflow.com/questions/31879804/you-are-not-logged-in-please-log-in-and-try-again

I bet it has something to do with adding the platform in facebook. Now I’m trying to figure out what my ios bundle ID would be. Any help?

I got it working by adding the product iOS in the Facebook developer console and adding host.exp.Exponent in the Bundle ID field. It took me a while to find because the screen you show in your documentation does not say anywhere that it is on the Facebook developer site so I thought it was on your site. This is very unclear. I have submit a pull request to help make it more clear:

1 Like

It probably could still be more clear if there was a caption under the photo that said it was from the Facebook developer site and not your site.