Select Facebook from the supported type of authentication, and your Facebook authentication is set.
Setup after Project download
To authenticate with Facebook, follow the steps below in your application for Android and iOS.
Android
Register your Application
At Facebook developers page register and configure your application, and copy the App ID.
Edit Resources and Manifest
- Add your App ID and Client Token at
/android/app/src/main/res/values/strings.xml
in your application, as shown below;
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Auth</string>
<!-- Replace "000000000000" with your Facebook App ID here. -->
<string name="facebook_app_id">000000000000</string>
<!-- Replace "YOUR_CLIENT_ACCESS_TOKEN" with your client access token here. -->
<string name="facebook_client_token">YOUR_CLIENT_ACCESS_TOKEN</string>
</resources>
- Open the
/app/manifest/AndroidManifest.xml
file and addmeta-data
elements to theapplication
element for your app ID and client token, as shown below;
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
<meta-data android:name="com.facebook.sdk.ClientToken" android:value="@string/facebook_client_token"/>
If the file doesn’t exist then create a new file at mentioned path and add it similarly.
iOS
Register your Application
Register and Configure Your App with Facebook at the Facebook Login documentation for iOS.
You can skip "Step 2: Set up Your Development Environment" and "Step 5: Connect Your App Delegate".
After you've done that, look for your Facebook App ID
. You can find your Facebook App ID in your Facebook App's dashboard in the Facebook developers console.
Once you have the Facebook App ID figured out, then you'll just have to add or paste the following to your Info.plist
file and add required data wherever mentioned in comments, before the ending </dict></plist>
tags.
Path to your Info.plist file: <your project root>/ios/Runner/Info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<!--
Replace "fbAPP-ID" with your Facebook App ID here.
**NOTE**: The scheme needs to start with `fb` and then your ID.
-->
<string>fbAPP-ID</string>
</array>
</dict>
</array>
<key>FacebookAppID</key>
<!--
Replace "APP-ID" with your Facebook App ID here.
-->
<string>APP-ID</string>
<key>FacebookClientToken</key>
<!--
Replace "CLIENT-TOKEN" with your Facebook client-token here.
-->
<string>CLIENT-TOKEN</string>
<key>FacebookDisplayName</key>
<!--
Replace "APP-NAME" with your application name here.
-->
<string>APP-NAME</string>Copy Code
If you get below type of error
.gradle/caches/transforms-2/files-2.1/24fa3aa8d2270e5eb067bbe36e9b7563/jetified-kotlin-stdlib-1.5.10.jar!/META-INF/kotlin-stdlib.kotlin_module: Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.5.1, expected version is 1.1.15.
, then go inside android/build.gradle
and change the below:
ext.kotlin_version = '1.3.50'
to
ext.kotlin_version = '1.4.32'
After this process, you must reinstall your application to check the implementation.
To release your app, you have to follow the steps mentioned in Facebook Developer Documentation
Got a question? Ask here.