Skip to content

Stratkit Facebook Sign-In

Native Facebook Login wrapper for Unity. Provides an async API to authenticate users via Facebook and retrieve a token for backend verification.

Supported Platforms

Platform SDK Token returned
Android facebook-login 18.x Graph API access token (FacebookTokenType.AccessToken)
iOS FBSDKLoginKit 18.x, Limited Login OIDC JWT (FacebookTokenType.AuthenticationToken)
Editor Mock provider (returns test token) -

iOS always uses Limited Login, so login works the same whether or not the user allowed tracking. The backend must accept both token types.

Setup

1. Facebook developer console

  • Enable Facebook Login for the Android package name and key hashes, and for the iOS bundle ID.
  • Copy the client token from Settings > Advanced > Security.

2. Configuration Asset

Create a FacebookSignInConfiguration ScriptableObject:

Right-click in Project > Create > Stratkit > Facebook Sign-In > FacebookSignInConfiguration

Fill in AppId and ClientToken. Permissions defaults to public_profile and email.

The build processors find the asset by type, so keep exactly one in the project.

3. Initialize at Startup

FacebookSignInService.Configure(facebookSignInConfiguration);

4. Sign In

try {
    FacebookSignInResult result = await FacebookSignInService.SignInAsync();
    // Send result.Token to your backend for verification
} catch (FacebookSignInException e) {
    // Handle error (e.ErrorCode for specific failure reason)
}

Native SDK Dependencies

Declared in Editor/FacebookSignInDependencies.xml and resolved by EDM4U:

  • Android: com.facebook.android:facebook-login
  • iOS: FBSDKLoginKit CocoaPod

Run Assets > External Dependency Manager > Resolve after importing the package.

Build Post-Processing

  • iOS (FacebookSignInIOSProcessor): adds FacebookAppID, FacebookClientToken, FacebookDisplayName, the fb<AppId> URL scheme and the queried Facebook schemes to Info.plist, and enables Swift standard library embedding.
  • Android (FacebookSignInAndroidProcessor): adds the SDK meta-data and the FacebookSignInActivity declaration to the manifest.

Both turn off automatic app event logging and advertiser ID collection; the package is for login only.