- Mastering Firebase for Android Development
- Ashok Kumar S
- 268字
- 2021-06-18 18:49:20
Facebook App ID and App secret
The Facebook login service needs the application ID and application secret to have a secure connection between your application and Facebook. The app ID and secret key are unique and are assigned by Facebook. To create the App ID and secret key, visit the following URL: https://developers.facebook.com/. We can add the new application from the My Apps option:
We can visit the following URL to add the new project: https://developers.facebook.com/apps/. Here, we will see a button labeled Add a New App which enables us to add a new application:
Fill out the form with your application details such as app name, developer email address, and so on. After successful project creation, you will see all the Facebook products; choose Facebook Login:
Here, we can copy the latest SDK Gradle dependency in the quick start guide:
implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
Now, enter the package name and default class, as shown in the screenshot:
To add the hash key, Mac users should use the following command:
keytool -exportcert -alias androiddebugkey -keystore ~/.android/debug.keystore | openssl sha1 -binary | openssl base64
We will see the hash key in the terminal:
//debug Hash key
ga0RGNYHvNM5d0SLGQfpQWAPGJ8=
Windows users can execute the following command:
keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" sha1 -binary | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" base64
To generate a release key at the time of publishing, the application will use the following command to generate a new hash:
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH | openssl sha1 -binary | openssl base64
Single sign-in is enabled when you want to launch the application from Android notifications.