> For the complete documentation index, see [llms.txt](https://docs.candy-smith.com/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.candy-smith.com/main/general-info/facebook/facebook_troubleshooting.md).

# FACEBOOK\_TROUBLESHOOTING

Use this page after completing [Facebook and Leaderboard setup](broken://pages/6d10d7924be8dbe7bec8ec8681388c9e614ac205). The original Candy Smith troubleshooting list includes legacy Gamesparks and older Unity/Facebook SDK issues; the entries below are adapted to the current UGS-based project.

## Facebook login problems

### `Invalid key hash`

This means that Meta does not recognize the certificate that signed the installed Android build.

{% stepper %}
{% step %}

## Copy the key hash

Copy the key hash shown in the device error or log.
{% endstep %}

{% step %}

## Open the Meta app dashboard

Open the Meta app dashboard.
{% endstep %}

{% step %}

## Open Android platform settings

Open the Android platform settings.
{% endstep %}

{% step %}

## Add the key hash

Add the exact key hash to **Key Hashes** and save.
{% endstep %}

{% step %}

## Rebuild and reinstall

Rebuild and reinstall the app.
{% endstep %}
{% endstepper %}

Add separate hashes for debug, internal testing, and release signing certificates. Also confirm that the package name in Meta exactly matches Unity's Android application identifier.

![Android key hash mismatch example](https://content.gitbook.com/content/ixseEfHbM88cpcinnJo4/blobs/Nj2eGPRah32X4mjota9K/images/facebook/key-hash-mismatch.png)

### Facebook Login is unavailable for this app

Check the following:

* The app ID in `LeaderboardSettings.asset` belongs to the selected Meta app.
* The Android package name or iOS Bundle ID matches the Meta platform configuration.
* The test account is an app admin, developer, tester, or approved test user while the app is in development mode.
* The app is Live only after the required review and verification steps are complete.
* The Facebook Login product is configured for the target platform.

![Facebook Login error](https://content.gitbook.com/content/ixseEfHbM88cpcinnJo4/blobs/Vq99ZUixNJCpKLxoqdyR/images/facebook/facebook-login-error.png)

### Login fails after changing the app ID

Use one app ID consistently in all places:

* Meta Developer Dashboard
* `Assets/HomeDesignMatch3Kit/Resources/Settings/LeaderboardSettings.asset`
* `Assets/FacebookSDK/SDK/Resources/FacebookSettings.asset`
* The generated Android manifest

Update the value through `HomeDesignMatch3Kit > Settings > Setup Wizard`, then regenerate the Android manifest and make a clean device build.

### Unity Editor login fails

The Facebook SDK's Unity Editor integration uses the Mock Login Dialog. Enter a valid Facebook user access token for the app. Do not enter the App ID, Client Token, or App Secret in the token field.

For a real Facebook Login test, use an Android or iOS device build with the correct platform configuration.

### `user_friends` is missing or rejected

See [Requesting the `user_friends` permission](broken://pages/a696c31dab7ab7065d718e6a0baed932029d9a56). Confirm that the submitted app review describes a real feature and that the test accounts are allowed to use the development app.

## Unity setup problems

### Facebook SDK is installed more than once

An error such as:

```
An assembly with the same name `Facebook.Unity.Settings` has already been imported.
```

usually means that two SDK copies or a stale generated assembly are present. Keep one Facebook SDK installation, remove the duplicate package, restart Unity, and let the project reimport the assets.

Do not import another Facebook Unity SDK on top of the SDK installed by the setup wizard.

### Android manifest is missing Facebook entries

{% stepper %}
{% step %}

## Confirm the Facebook SDK is installed

Confirm that the Facebook SDK is installed.
{% endstep %}

{% step %}

## Enter the App ID and Client Token

Enter a valid numeric App ID and Client Token in the setup wizard.
{% endstep %}

{% step %}

## Save Facebook settings

Save the Facebook settings.
{% endstep %}

{% step %}

## Regenerate the Android manifest

Click **Regenerate Android Manifest**.
{% endstep %}

{% step %}

## Rebuild the application

Rebuild the Android application.
{% endstep %}
{% endstepper %}

If regeneration reports that the manifest generator is missing, the SDK import is incomplete or the project contains conflicting SDK assemblies.

### Android build dependency or resolver errors

Run the dependency resolver from the project menu when it is available:

```
Assets > External Dependency Manager > Android Resolver > Resolve
```

Then restart Unity and rebuild. Check that only one version of each Facebook and Android dependency is present.

![Android Resolver menu](https://content.gitbook.com/content/ixseEfHbM88cpcinnJo4/blobs/XEQdzAWrnvibicugWYlp/images/facebook/android-resolver.png)

### `Keytool not found`

Unity cannot find the Java keytool used to inspect or create signing certificates. Configure a valid JDK in Unity Hub or in `Edit > Preferences > External Tools`, then retry the Android build and key-hash step.

## Unity Authentication and Cloud Code problems

### Automatic Facebook Authentication setup fails

The automatic setup requires:

* The Unity project to be linked to a UGS project.
* An active UGS environment.
* A numeric Facebook App ID.
* A valid Facebook App Secret entered in the setup wizard.
* Unity Authentication enabled for the project.

The App Secret is used during setup and must not be saved in the repository. If the operation fails, correct the values and run **Configure Facebook Automatically** again.

### Facebook login succeeds but player mapping is missing

Make sure Cloud Save is enabled in the active environment and that the setup wizard has uploaded and published `RegisterFacebookPlayer.js` and `ResolveFacebookPlayers.js`.

The mapping collection is created on the first successful Facebook sign-in. Sign in again after Cloud Code deployment and inspect the Cloud Code logs for the active environment.

### Leaderboard is empty or scores do not update

Check the following:

* Unity Services initialization completes before opening the leaderboard.
* The game is using the same UGS environment in which the leaderboard was created.
* `leaderboardId` matches the configured leaderboard ID.
* The player is authenticated with Unity Authentication.
* At least one level has been completed or played far enough to submit a score.
* The setup wizard created the leaderboard with the expected ID.

The current leaderboard uses UGS scores. It does not read the old Gamesparks leaderboard and it does not automatically filter entries to Facebook friends.

### `Configure Leaderboard` fails

Verify that the Unity Editor is signed in, the project is linked, and an environment is selected in Project Settings > Services. Run the operation again after correcting the environment.

## App Review problems

### Review is rejected

The most common causes are an incomplete privacy policy, a video that does not show the requested permission in use, invalid test credentials, or a request for permissions that the build does not actually need.

Use the [user\_friends permission guide](broken://pages/a696c31dab7ab7065d718e6a0baed932029d9a56) to prepare the test flow and video. Submit only the permissions required by the final feature set.

### The reviewer cannot reproduce the feature

Use a clean install and verify the complete path from the first screen to the social feature. The review instructions must match the exact labels and navigation of the submitted build. Do not copy the legacy map instructions if the current build opens Facebook Login from Settings.

## Legacy issues from the original guide

The following original-guide items are not part of the current UGS integration:

* Gamesparks `Scripting Runtime Version` errors
* Adding a `GameSparksUnity` component to `NetworkManager`
* Deleting and recreating a Gamesparks game
* PlayFab/Gamesparks leaderboard configuration

Do not apply those fixes to this project unless a separate legacy branch explicitly uses the corresponding backend.
