Facebook login not working in standalone Android app

Hi there,
I just want to share here an issue I ran into, just in case some of you face the same…

The problem

I recently encountered an issue with Facebook Login in a standalone published Android app.
Everything worked fine in dev but the login didn’t work once the app was published…

Some background

I had follow the steps in the docs and used the

expo fetch:android:hashes

to get the hash to add in the Facebook login app…

Everything worked well until I actually install the FB app on my device. Instead of using the web login, it was now using the FB app login and I suddenly couldn’t login anymore…

The solution

If you have enabled (as recommended by the Play store) the App signing certificate, your app will be resigned when published… And the hash you used before will not match the one your app uses…
It is actually stated (but easily disregarded when you use the expo fetch:android:hashes command… In the terminal, it says

Note: if you are using Google Play signing, this app will be signed with a different key after publishing to the store, and you’ll need to use the hashes displayed in the Google Play console.

So you need to add the Play store generated key in your Facebook app in order for it to work if the login flow uses the app…

To find this hash, you need some extra simple steps…

  1. Login to your Play store console
  2. Navigate to your app
  3. Navigate to ‘Release management’ > ‘App signing’
  4. Locate the ’ App signing certificate’
  5. Copy the hexadecimal value of the ‘SHA-1 certificate fingerprint’
  6. Back in your terminal run echo <YOUR_HEX_SHA-1> | xxd -r -p | openssl base64
  7. Copy the result and paste it in the Android Key Hashes in your Facebook app config.

Now everything is working well…

I hope it will help some of you if you are facing the same issue!
Cheers!