diff --git a/docs/godot/identifying.mdx b/docs/godot/identifying.mdx index f5fb9f0..6764892 100644 --- a/docs/godot/identifying.mdx +++ b/docs/godot/identifying.mdx @@ -97,8 +97,8 @@ You can merge players using `Talo.players.merge()` by providing the IDs of both :::caution There are a few limitations to merging players: -- **Player 2** cannot have a Talo Player Authentication alias or a Steam alias. -- If **Player 1** has a Talo Player Authentication or Steam alias, the merge must be initiated while identified as **Player 1** (i.e. `Talo.current_alias` must belong to Player 1). In this case, make sure your last `Talo.players.identify()` call before merging uses Player 1's alias. +- **Player 2** cannot have a Talo Player Authentication, Steam or Google Play Games alias. +- If **Player 1** has a Talo Player Authentication, Steam or Google Play Games alias, the merge must be initiated while identified as **Player 1** (i.e. `Talo.current_alias` must belong to Player 1). In this case, make sure your last `Talo.players.identify()` call before merging uses Player 1's alias. - Both players cannot have overlapping alias services. For example, if both players have an alias with the service "username", the merging process will fail. ::: @@ -164,6 +164,50 @@ You can build an avatar URL by replacing **[AVATAR_HASH]** with the `META_STEAMW These props will be updated each time the player is identified using `Talo.players.identify_steam()`. +## Google Play Games integration + +:::tip +You can enable this integration on the [integrations page](https://dashboard.trytalo.com/integrations). +::: + +If you have the Google Play Games integration enabled, Talo can identify a player using an OAuth client. Follow Google's official documentation for setting up [Game Server credentials](https://developer.android.com/games/pgs/console/setup#generate_an_oauth_20_client_id). + +All you need to do is pass a server auth code to the `Talo.players.identify_google_play_games` function. Here's an example using the [Godot Play Games Services plugin](https://github.com/godot-sdk-integrations/godot-play-game-services): + +```gdscript +extends Node2D + +@onready var play_games_sign_in_client: PlayGamesSignInClient = %PlayGamesSignInClient + +func _enter_tree() -> void: + GodotPlayGameServices.initialize() + +func _ready() -> void: + play_games_sign_in_client.user_authenticated.connect( + func (is_authenticated): + if is_authenticated: + play_games_sign_in_client.request_server_side_access("yourid.apps.googleusercontent.com", false) + ) + + play_games_sign_in_client.server_side_access_requested.connect( + func (auth_code): + Talo.players.identify_google_play_games(auth_code) + ) + + play_games_sign_in_client.is_authenticated() +``` + +Replace "yourid.apps.googleusercontent.com" with the client ID you generated earlier. + +### Google Play Games player props + +After successfully authenticating the player, these [props](/docs/godot/player-props) will automatically be created for them: + +- `META_GOOGLE_PLAY_GAMES_DISPLAY_NAME` - The player's chosen display name +- `META_GOOGLE_PLAY_GAMES_AVATAR_URL` - A direct link to the player's avatar + +These props will be updated each time the player is identified using `Talo.players.identify_google_play_games()`. + ## Offline player cache If the `cache_player_on_identify` setting is enabled (default `true`), Talo will store player data locally. If a player tries to identify while offline, Talo will try and use local data if it exists. diff --git a/docs/integrations/google-play-games.md b/docs/integrations/google-play-games.md new file mode 100644 index 0000000..3225a7b --- /dev/null +++ b/docs/integrations/google-play-games.md @@ -0,0 +1,24 @@ +--- +sidebar_position: 2 +description: Use Talo's native Google Play Games integration to automatically identify players signed in to Google. +--- + +# Google Play Games + +Using [Game Server credentials](https://developer.android.com/games/pgs/console/setup#generate_an_oauth_20_client_id), you can automatically identify players signed in to Google Play Games. + +You can enable this integration on the [integrations page](https://dashboard.trytalo.com/integrations). + +![The Talo integrations page showing the Google Play Games settings](/img/gpg-integration.png) + +
+ +## Authentication + +To get started, [create an OAuth client](https://developer.android.com/games/pgs/console/setup#generate_an_oauth_20_client_id) (ensure you create credentials for a **Game server**) and copy the details into the dashboard. + +To identify a player, [request a server auth code](https://developer.android.com/games/pgs/android/server-access) and pass the code to Talo. Talo will automatically sync the player without them needing to create an account. + +Talo will also add helpful `props` to your player such as their display name and avatar URL. + +More info is available in the [Godot plugin docs](/docs/godot/identifying#google-play-games-integration) and [Unity package docs](/docs/unity/identifying#google-play-games-integration). diff --git a/docs/integrations/steamworks.md b/docs/integrations/steamworks.md index 94f20c2..bc73756 100644 --- a/docs/integrations/steamworks.md +++ b/docs/integrations/steamworks.md @@ -19,7 +19,7 @@ By setting up the Talo Steamworks integration, you are able to authenticate and You'll need to pass the ticket generated by the [GetAuthTicketForWebApi](https://partner.steamgames.com/doc/api/ISteamUser#GetAuthTicketForWebApi) API when identifying players. Using this, Talo will automatically verify the session and sync the player. -Talo will also add helpful `props` to your player such as app ownership details and ban statuses. +Talo will also add helpful `props` to your player such as app ownership details, profile names and avatars. More info is available in the [Godot plugin docs](/docs/godot/identifying#steamworks-integration) and [Unity package docs](/docs/unity/identifying#steamworks-integration). diff --git a/docs/unity/identifying.mdx b/docs/unity/identifying.mdx index 752863b..150e7df 100644 --- a/docs/unity/identifying.mdx +++ b/docs/unity/identifying.mdx @@ -80,7 +80,7 @@ public void DoStuffIfIdentified() { try { - Talo.IdentityCheck(); + Talo.IdentityCheck(); } catch (Exception ex) { @@ -100,24 +100,24 @@ Once all the relevant data has been cleared, the `Talo.Players.OnIdentityCleared ```csharp private async void ClearIdentity() { - try - { - await Talo.Players.ClearIdentity(); - } - catch (Exception ex) - { - Debug.LogError($"Failed to clear identity: {ex.Message}"); - } + try + { + await Talo.Players.ClearIdentity(); + } + catch (Exception ex) + { + Debug.LogError($"Failed to clear identity: {ex.Message}"); + } } // Listen for the identity cleared event void Start() { - Talo.Players.OnIdentityCleared += () => - { - Debug.Log("Player identity has been cleared"); - // Handle post-clear logic here - }; + Talo.Players.OnIdentityCleared += () => + { + Debug.Log("Player identity has been cleared"); + // Handle post-clear logic here + }; } ``` @@ -132,8 +132,8 @@ You can merge players using `Talo.Players.Merge()` by providing the IDs of both :::caution There are a few limitations to merging players: -- **Player 2** cannot have a Talo Player Authentication alias or a Steam alias. -- If **Player 1** has a Talo Player Authentication or Steam alias, the merge must be initiated while identified as **Player 1** (i.e. `Talo.CurrentAlias` must belong to Player 1). In this case, make sure your last `Talo.Players.Identify()` call before merging uses Player 1's alias. +- **Player 2** cannot have a Talo Player Authentication, Steam or Google Play Games alias. +- If **Player 1** has a Talo Player Authentication, Steam or Google Play Games alias, the merge must be initiated while identified as **Player 1** (i.e. `Talo.CurrentAlias` must belong to Player 1). In this case, make sure your last `Talo.Players.Identify()` call before merging uses Player 1's alias. - Both players cannot have overlapping alias services. For example, if both players have an alias with the service "username", the merging process will fail. ::: @@ -212,6 +212,53 @@ You can build an avatar URL by replacing **[AVATAR_HASH]** with the `META_STEAMW These props will be updated each time the player is identified using `Talo.Players.IdentifySteam()`. +## Google Play Games integration + +:::tip +You can enable this integration on the [integrations page](https://dashboard.trytalo.com/integrations). +::: + +If you have the Google Play Games integration enabled, Talo can identify a player using an OAuth client. All you need to do is pass a server auth code to the `Talo.Players.IdentifyGooglePlayGames` function. + +The official Google Play Games Plugin has documentation for how to [request server auth codes](https://developer.android.com/games/pgs/unity/unity-start#retrieve-auth-codes). + +```csharp +using GooglePlayGames.BasicApi; + +// Define selectedScope having additional identity scopes. +private List selectedScopes = new List(); + +// Add scopes you want to request. +selectedScopes.Add(AuthScope.OPEN_ID); +selectedScopes.Add(AuthScope.PROFILE); +selectedScopes.Add(AuthScope.EMAIL); + +// Call RequestServerSideAccess with additional scopes and retrieve +// authcode and grantedscopes list. +PlayGamesPlatform.Instance.RequestServerSideAccess( + /* forceRefreshToken= */ false, + selectedScopes, + (AuthResponse authResponse) => + { + string authCode = authResponse.GetAuthCode(); + List grantedScopes = authResponse.GetGrantedScopes(); + + // Pass the auth code to Talo + // Alternatively, you can `await` the result + _ = Talo.Players.IdentifyGooglePlayGames(authCode); + } +); +``` + +### Google Play Games player props + +After successfully authenticating the player, these [props](/docs/unity/player-props) will automatically be created for them: + +- `META_GOOGLE_PLAY_GAMES_DISPLAY_NAME` - The player's chosen display name +- `META_GOOGLE_PLAY_GAMES_AVATAR_URL` - A direct link to the player's avatar + +These props will be updated each time the player is identified using `Talo.Players.IdentifyGooglePlayGames()`. + ## Offline player cache If the `cachePlayerOnIdentify` setting is enabled (default `true`), Talo will store player data locally. If a player tries to identify while offline, Talo will try and use local data if it exists. diff --git a/src/components/HomepageFeatures.tsx b/src/components/HomepageFeatures.tsx index b695a17..1aa86de 100644 --- a/src/components/HomepageFeatures.tsx +++ b/src/components/HomepageFeatures.tsx @@ -39,9 +39,7 @@ const FeatureList = [ { title: 'Integrations', Svg: require('../../static/img/tabler-icon-exchange.svg').default, - description: ( - <>Learn how integrations like Steamworks sync with Talo and how to configure them. - ), + description: <>Learn more about Talo's Steamworks and Google Play Games integrations., link: '/docs/integrations/steamworks', }, ] diff --git a/static/img/gpg-integration.png b/static/img/gpg-integration.png new file mode 100644 index 0000000..317da88 Binary files /dev/null and b/static/img/gpg-integration.png differ