Use Google Play Games Services authentication to streamline the user platform authentication
experience for your game. Initialize the Play Games Services SDK to trigger
authentication, which removes the need for a separate platform authentication
flow.

## Link user accounts to enable continuity and cross-device Play

Players engage with their favorite games across a variety of devices and
platforms, including mobile, tablets, and PCs. A core expectation for these
players is the ability to seamlessly resume their gameplay exactly where they
left off, regardless of the device they choose.

A significant barrier that often leads to user abandonment is the
requirement to sign in separately on each new device. Users need immediate
immersion into the game experience, free from unnecessary interruptions.

To facilitate seamless continuity and cross-device play, you must implement two
key features:

- Account linking
- [Cloud Save](https://developer.android.com/games/pgs/savedgames)

The Play Games Services authentication process provides flexible
options for player identifiers. These options allow you to integrate
Play Games Services with your own existing identity solution.

## New Play Games Services integration

For games without existing Play Games Services integration, the [Recall API](https://developer.android.com/games/pgs/recall)
simplifies backend setup by managing account associations and storing the
connection between a user's game account and their
Play Games Services account.

### Account linking using Recall API

The Recall API is the recommended solution for linking user
accounts in cross-platform games. This API is particularly useful for games
without existing Play Games Services integration or those that use additional
platform authentication solutions beyond Play Games Services.

The Recall API simplifies your game's backend setup by managing account
associations.

- **Simplified backend:** The API streamlines your game's backend setup for account linking.
- **Play-Managed associations:** Play stores the association between users' game accounts (including third-party accounts) and their Play Games Services accounts.
- **Progress restoration:** Developers generate and send Recall tokens to Play, which can then be retrieved to restore a user's game progress.

When implementing the Recall API, developers must verify that Recall tokens are
opaque strings. These tokens must be free of any sensitive or
personally-identifiable information (such as name, email address, or
demographics) about gamers.

Games must use robust encryption algorithms when generating
Recall tokens to protect user data and maintain security.

To learn more about how Recall works, see [Recall API](https://developer.android.com/games/pgs/recall).

To implement the Recall API feature, see
[Integrate the Play Games Services Recall API within your game](https://developer.android.com/games/pgs/recall/recall-setup).

### Manage multiple accounts with Recall API

When managing multiple accounts for the same user, you can treat each account as
a distinct persona. This approach allows for tailored experiences based on the
user's specific context.

To implement this approach, follow these steps:

- Generate a unique token for each persona. See [Game client setup](https://developer.android.com/games/pgs/recall/recall-setup#game-client).
- Link these tokens to the Play Games Services account using the Recall API. See [Store tokens](https://developer.android.com/games/pgs/recall/recall-setup#using-recall).
- Set a resolution policy for scenarios where a Play Games Services account is linked with multiple personas. See [Latest recall token across all games owned by developer accounts](https://developer.android.com/games/pgs/recall/recall-setup#latest_recall_token_across_all_games_owned_by_developer_account).

While various policy options are available (such as
automatically restoring the last account), we strongly recommend presenting a
prompt to the user. This prompt should ask them to select which account they
want to restore, providing a clear and user-friendly experience.
| **Note:** When multiple accounts link with one Play Games Services account, switching linked accounts does not reset Play Games Services mechanics, such as Achievements and Leaderboard scores. For example, if account A and account B both link to the same Play Games Services profile, Achievements unlocked for account A are not unlocked again for account B, even if account B can replay the same levels or game loop.

## Existing Play Games Services integration

This section explains how to integrate your game with Play Games Services by
binding player accounts. Learn how to use player IDs to identify authenticated
players and manage multiple game accounts for a single Play Games Services
user.

### Bind with a `Player_id`

A player ID is an identifier for a Play Games Services player account. Your
game can retrieve a player ID for any player who is authenticated into your game
using Play Games Services.

The games that have the backend set up with Play Games Services `Player_Id` or
the games that require support for child users, should use `Player_Id` and bind
their game and 3P accounts with `Player_Id`.

Understand how player IDs behave:

- **Consistent within a game:** A player ID remains consistent for a user across multiple devices when they play the same game.
- **Inconsistent between games:** Player IDs are not always consistent when a user plays different games.

For more information, see [next generation Player IDs](https://developer.android.com/games/pgs/next-gen-player-ids).

### Manage multiple accounts per user with binding

To link multiple user accounts to a single Play Games Services account, create
a one-to-many mapping in your table.
| **Note:** When restoring progress using the Play Games Services identifier, you must display account identifiers clearly to the user. Then, prompt the user to select which account to restore.

## Cross-platform Google identity

You can implement a cross-platform (Android and iOS) identity solution using
[Sign-in-with-Google](https://developers.google.com/identity/siwg) (SiWG).

Choose from the following options based on the experience you want for your
users.

### Recall with Sign-in-with-Google

To provide a consistent and seamless sign-in experience for your users,
integrate SiWG with Play Games Services by following
these steps:

- **Implement SiWG across platforms.** Deploy SiWG on both Android and iOS to offer users a unified sign-in screen.
- **Generate and send tokens on Android.** On Android, use the Recall API to generate SiWG tokens. Send these tokens to Play Games Services.
- **Restore user progress.** Play Games Services securely stores the link between the user's Play Games Services account and their SiWG identity. You can retrieve this linking information to restore user progress, similar to other third-party identity solutions.

### Bind with `openid` or `email`

To streamline the user experience, you can implement an alternative
authentication strategy that avoids explicit sign-in for Android users. This
approach leverages Play Games Services authentication on Android while
retaining SiWG for iOS.

Key aspects of this setup include:

- **Android Authentication:** Your game initializes the Play Games Services SDK to trigger authentication automatically on Android devices.
- **iOS Authentication:** For iOS users, continue to display the standard SiWG prompt.
- **Cross-Platform Identifiers:** Play Games Services now provides `openid` and `email` scopes, identical to those offered by SiWG. These scopes are crucial for establishing consistent cross-platform user identifiers.
- **Account Binding:** To create a unified user experience across platforms, you must bind users' other accounts with the `openid` or `email` provided by Play Games Services.