With the release of AppGallery Connect version 1.5.2 the Auth service now has full support for making use of unified sign-in with a Facebook account!
This new functionality makes AppGallery Connect Auth a great option for all of your app's authentication needs both on Huawei devices and other Android devices.
So how do we go about using unified sign-in with a Facebook account? Let's take a look!
First, you'll need to configure the Facebook Login environment.
Develop a key hash using the following command, and release it for your app.
If you haven't installed OpenSSL (openssl-for-windows) for your project, please go to Google Code Archive and download it as required.
The command format is as follows:
keytool -exportcert -alias YOUR_RELEASE_KEY_ALIAS -keystore YOUR_RELEASE_KEY_PATH* | openssl sha1 -binary | openssl base64
Sign in to AppGallery Connect, create a project and an app, and enable Auth Service. You'll need to enter the App ID and App Secret for your app when enabling Facebook under Authentication modes, which can be found under Settings > Basic on Facebook for Developers. If they are not displayed, click the button following App Secret to show them.
If the demo project does not provide a Java KeyStore, go to Generate Signed Bundle or APK and click Create new.key store to create one
Generate an SHA-256 certificate fingerprint. Run the following command and enter the configured password to generate a SHA-256 certificate fingerprint.
Open the app-level build.gradle file, and configure the certificate information for your project
Click here to view the sample code.
Open the project-level build.gradle file and configure information, including the Maven repository address. The code is as follows:
Open the app-level build.gradle file and configure information, including the SDK information and app plug-in address. The code is as follows:
Add the code for implementing unified sign-in:
Once you run your signed APK on an Android phone and call the FaceBookLogin method, you'll get the following page.
Compared with the traditional implementation mode, the unified sign-in has greatly simplified the development process. It is strongly recommended that you use the new mode.
For details about Auth Service, please refer to: