3.6 Facebook Login Setup for Android

Facebook login requires business verification now. So, If you have any organization that completed the business verification process, then you can set up the Facebook login. Otherwise, skip this and disable the Facebook login by following this.

  • Now you have set up Facebook sign-in. To do that, Go to this ​URL.​

  • Go to My apps > Create App.

  • Enter the App name and email and go to the Dashboard tab.

For the next step, you need to generate two hash ids. To do that, run the following commands on the terminal.

  1. Scroll down on the right pane until you reach ‘Add a product’, select Facebook Login

  2. You will be redirected to the quick start page.

  3. Select Android. Skip 1 & 2.

  4. Enter your_package_name in the package option and enter your_package_name.MainActivity​ in the activity option.

keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
  1. Use ​android​ as a debug password. After that, you will get a hash id like this.

  1. For the release hash id, run the following command by replacing your alias key name and Keystore location. You can get these from your a​ndroid/key.properties ​file.

keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64
  1. After that, you will get another hash id. Now, copy and paste them into the next steps of the Facebook developer site. Like this,

  1. Skip all the steps by clicking next.

  2. Now go to the settings tab & copy both the app id and app secret key.

  3. Now go to firebase console > your project > authentication > Sign-in-method and click on Facebook, enable it and paste both app id and app secret key and save it.

  4. Now go to ​android/app/src/main/res/values/strings.xml file​ and change the facebook_app_id and facebook_client_token.

You will get the Facebook client token from https://developers.facebook.com/ > Your_app > Settings > Advance tab.

Last updated