You can use Facebook Authentication to allow users to sign in to your app using their facebook account.
Install-Package Plugin.Firebase.Auth.Facebook
- Follow the instructions for the basic setup
- Enable Authentication at your project in the Firebase Console.
- Add the following lines of code after calling
CrossFirebase.Initialize()
:
#if IOS
FirebaseAuthFacebookImplementation.Initialize(app, launchOptions, "your-facebook-id", "your-facebook-app-name");
#endif
- The
facebookId
andfacebookAppName
can be accessed at Facebook Developers
- Add the following code to your apps
AndroidManifest.xml
:
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id" />
<activity android:name="com.facebook.FacebookActivity" android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation" android:label="@string/app_name" />
<activity android:name="com.facebook.CustomTabActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
- Add
facebook_app_id
andfb_login_protocol_scheme
tostrings.xml
:
<string name="facebook_app_id">12345678</string>
<string name="fb_login_protocol_scheme">fb12345678</string>
- Call
FirebaseAuthFacebookImplementation.HandleActivityResultAsync(requestCode, resultCode, data);
fromMainActivity.OnActivityResult(...)
- Version 2.0.1
- Remove unnecessary UseMaui property from csproj files
- Readd net6.0 tfm