Skip to content

Handle account linking conflicts

If the login method you are trying to link is already linked to another Player ID, an account linking conflict occurs. This is because one login method cannot be linked to two or more Player IDs at the same time. This situation mostly occurs when the user has a previous play record with that account, so the app must ask the user whether to keep the current account or move to the previous account, and then handle the user's choice.

The Hive Axyl SDK only reports that a conflict occurred. ProviderOwnedByOther, returned by LinkProviderAsync(), does not contain information such as the usage history or restriction status of the other account, so you design in the app client what to show the user and which options to offer.

1. Detect the conflict

The conflict surfaces when the user attempts account linking. The app client detects the conflict from the result of the linking request and shows the options to the user.

  1. The user selects Link account for a login method such as Google on the Settings > Account screen of the app.
  2. The app client authenticates with that login method and calls LinkProviderAsync() with the values it received. For the parameters, see Link accounts and get linked login methods.
  3. If the returned result is ProviderOwnedByOther, it is a conflict. Let the user know that other usage data is linked to this account, and guide the user to choose either keeping the current account or switching to the conflicting account.

If the result is Success, there is no conflict, so proceed to the linking completed screen. For other results, see the response status in Link accounts and get linked login methods.

2. Switch to the conflicting account

This is the case where the user chooses to move to the previous account. Linking cannot merge two accounts, so log in again with the conflicting account and switch the session to that Player ID.

  1. The user selects the switch option in the conflict notice.
  2. The app client runs the login flow of that login method again from the beginning. It calls LoginProviderAsync() with the authentication result, exchanges the received authorization code for a token, and then registers it in the session. For the implementation for each login method, see Log in with an external authentication provider.
  3. Handle the returned result.
    • Success: The session switches to the Player ID of the conflicting account. The app client reloads the app data based on the switched account and updates the screen.
    • Failure: The user canceled the authentication, or the verification of the authentication result failed. Stop the switch and return to the screen of the existing account.

When the user switches, the session of the previously used account is removed. To keep the credentials on the device so that the user can return to that account, see Switch between accounts.

3. Keep the current account

This is the case where the user chooses to keep using the current account. You only need to cancel the linking attempt, so there is no additional method to call.

  1. The user selects the option to keep the current account in the conflict notice.
  2. The app client closes the conflict notice and returns to the Settings > Account screen. The login method remains unlinked.

The current session and the linking list stay as they are, so the user continues to use the app.