Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/godot/identifying.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 2
description: The Talo Godot plugin allows you to identify multiple aliases, authenticate and sync your players with Steamworks.
description: The Talo Godot plugin allows you to identify multiple aliases, authenticate and sync your players with Steamworks and Google Play.
---

import { ScopeBadges } from '@site/src/components/ScopeBadges'
Expand Down Expand Up @@ -100,7 +100,7 @@ There are a few limitations to merging players:
- **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.
:::
:::

You can provide the `post_merge_identity_service` option to automatically re-identify the player once merging is complete:

Expand Down
35 changes: 35 additions & 0 deletions docs/godot/player-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,41 @@ You can provide your players with a self-service deletion link. This can be foun

When an alias is deleted, all leaderboard entries and game feedback associated with that alias will be deleted. Any channels owned by the alias will now have a `null` owner.

## Migrating accounts

<ScopeBadges scope='players' read write />

You can migrate a player's account to a different service and identifier using `Talo.player_auth.migrate_account()`. You'll need to provide the player's current password, the new service (e.g. `username`, `steam`, `google_play_games`) and the new identifier. The original player auth account will be deleted and they will only be able to use their new identifier.

Here is an example of migrating to a [Steam alias](/docs/godot/identifying#steamworks-integration):

```gdscript
@onready var current_password: TextEdit = %CurrentPassword
@onready var new_service: OptionButton = %NewService
@onready var new_identifier: TextEdit = %NewIdentifier
@onready var validation_label: Label = %ValidationLabel

var ticket_identity := "talo"

func _ready() -> void:
Steam.steamInitEx()
Steam.get_ticket_for_web_api.connect(_on_get_ticket_for_web_api)
Steam.getAuthTicketForWebApi(ticket_identity)

func _on_get_ticket_for_web_api(_auth_ticket: int, _result: int, _ticket_size: int, ticket_buffer: Array) -> void:
_migrate_account(PackedByteArray(ticket_buffer).hex_encode())

func _migrate_account(ticket: String) -> void:
var res = await Talo.player_auth.migrate_account(current_password.text, "steam", "%s:%s" % [ticket_identity, ticket])

if res != OK:
validation_label.text = Talo.player_auth.last_error.get_string()
```

You can also migrate to the `google_play_games` service by providing an [auth code](/docs/godot/identifying#google-play-games-integration).

When a migration is successful, the current session is cleared, the player's alias is updated to the new service and identifier, and the `Talo.players.identified` signal is emitted.

## Getting the last error

As shown in the examples above, whenever a request fails you can query the last error returned using the `Talo.player_auth.last_error` variable.
Expand Down
22 changes: 22 additions & 0 deletions docs/http/player-auth-api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,25 @@ When attempting to toggle verification on, this error is thrown if the player do
errorCode: 'VERIFICATION_EMAIL_REQUIRED'
}
```

### `EMAIL_TAKEN`

When registering an auth account with email verification, enabling email verification or changing an account's email, this error will be thrown if another player is already using the chosen email address.

```javascript
{
message: 'This email address is already in use',
errorCode: 'EMAIL_TAKEN'
}
```

### `INVALID_MIGRATION_TARGET`

When starting a player auth account migration, this error is thrown if an invalid service is provided. Currently the only invalid service is "talo".

```javascript
{
message: 'Cannot migrate to the Talo service',
errorCode: 'INVALID_MIGRATION_TARGET'
}
```
6 changes: 3 additions & 3 deletions docs/unity/identifying.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 2
description: The Talo Unity package allows you to identify multiple aliases, authenticate and sync your players with Steamworks.
description: The Talo Unity package allows you to identify multiple aliases, authenticate and sync your players with Steamworks and Google Play.
---

import { ScopeBadges } from '@site/src/components/ScopeBadges'
Expand All @@ -25,7 +25,7 @@ using TaloGameServices;

public class IdentifyPlayer: MonoBehaviour
{
public string service = 'steam', identifier = '123456';
public string service = 'username', identifier = '123456';

public void OnButtonClick()
{
Expand Down Expand Up @@ -135,7 +135,7 @@ There are a few limitations to merging players:
- **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.
:::
:::

You can provide the `post_merge_identity_service` option to automatically re-identify the player once merging is complete:

Expand Down
39 changes: 39 additions & 0 deletions docs/unity/player-authentication.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,45 @@ You can provide your players with a self-service deletion link. This can be foun

When an alias is deleted, all leaderboard entries and game feedback associated with that alias will be deleted. Any channels owned by the alias will now have a `null` owner.

## Migrating accounts

<ScopeBadges scope='players' read write />

You can migrate a player's account to a different service and identifier using `Talo.PlayerAuth.MigrateAccount()`. You'll need to provide the player's current password, the new service (e.g. `username`, `steam`, `google_play_games`) and the new identifier. The original player auth account will be deleted and they will only be able to use their new identifier.

Here is an example of migrating to a [Steam alias](/docs/unity/identifying#steamworks-integration):

```csharp
Callback<GetTicketForWebApiResponse_t> m_AuthTicketForWebApiResponseCallback;
string ticketIdentity = "talo";

void MigrateToSteam()
{
m_AuthTicketForWebApiResponseCallback = Callback<GetTicketForWebApiResponse_t>.Create(OnAuthCallback);
SteamUser.GetAuthTicketForWebApi(ticketIdentity);
}

async void OnAuthCallback(GetTicketForWebApiResponse_t callback)
{
var ticket = BitConverter.ToString(callback.m_rgubTicket).Replace("-", string.Empty);
m_AuthTicketForWebApiResponseCallback.Dispose();
m_AuthTicketForWebApiResponseCallback = null;

try
{
await Talo.PlayerAuth.MigrateAccount(currentPassword, "steam", $"{ticketIdentity}:{ticket}");
}
catch (PlayerAuthException ex)
{
validationLabel.text = ex.Message;
}
}
```

You can also migrate to the `google_play_games` service by providing an [auth code](/docs/unity/identifying#google-play-games-integration).

When a migration is successful, the current session is cleared, the player's alias is updated to the new service and identifier, and the `OnPlayerIdentified` event is invoked.

## Exceptions and error codes

As shown in the examples above, whenever a request fails with an authentication-related error, a `PlayerAuthException` will be thrown.
Expand Down
Loading