5. Players and sign-in
How player accounts work
Every player of your game is one player, with a playerId that never changes. A player can have several sign-in methods attached:
| Method | How the player signs in | Good for |
|---|---|---|
| Guest | Nothing: the device remembers them | Playing at once |
| A six-digit code sent to their email address (no password) | Any platform | |
| Google Sign-In on Android | Android players | |
| Apple | Sign in with Apple | iOS players (the App Store asks for it when you offer other sign-ins) |
| Custom | Your own server vouches for the player | Games that keep their own login system |
A player usually starts as a guest. Later they link Google, Apple or email, which keeps the same playerId and all their progress, and lets them sign in on another device.
A guest who never links a sign-in method is lost if the game is uninstalled. That's a good reason to suggest linking after the first few games.
Turn sign-in methods on
Open the app on SDK Apps and choose Sign-in and server access. Under How players sign in, turn on the methods you use, fill in what each needs (below), and choose Save. Nothing changes for players until you save: the card shows Unsaved changes until then, and Saved · live after.
| Method | What it needs |
|---|---|
| Guest | Nothing |
| Email sender name: your game's name. Codes arrive as " |
|
| OAuth client ids, below | |
| Sign in with Apple | Bundle ids / service ids, and optionally a Sign in with Apple key, below |
| Custom | Nothing here; see "Custom sign-in" below |
Server-only save prefix (on the same card) is explained in section 9. The default is server..
Google: OAuth client ids
Why: when a player signs in with Google, Google gives your game an ID token that names the OAuth client it was issued for. MultiConnectCloud accepts the token only if that client is one of yours, so a Google sign-in made in some other app can never sign in as one of your players.
How to get them: in the Google Cloud console, choose the project your game uses for Google (the same one as its Firebase project, if it has one), then APIs & Services → Credentials. Under OAuth 2.0 Client IDs:
- the Web client is the one your Google Sign-In plugin requests ID tokens for, and the one to enter first. A Firebase project already has one, named "Web client (auto created by Google Service)". Otherwise choose Create credentials → OAuth client ID → Web application.
- an Android client (package name plus your signing key's SHA-1) and an iOS client (bundle id) are needed for Google Sign-In to work in those builds. Enter them too if the plugin requests tokens with them.
Where it goes: each client id, ending in .apps.googleusercontent.com, one per line in OAuth client ids. They aren't secret.
How it's used: only to check the audience of each Google ID token.
Sign in with Apple: bundle ids, and the optional key
Bundle ids / service ids
- Why: Apple's identity token names the app it was issued for. MultiConnectCloud accepts it only for your app.
- How to get it: your app's bundle id (
com.studio.game), as in Unity's Player Settings → Other Settings → Bundle Identifier and in App Store Connect. If you also offer Sign in with Apple outside iOS (Android, web), add the Services ID from Apple Developer → Identifiers.
The Sign in with Apple key (optional, recommended for App Store games)
- Why: the App Store requires that deleting an account in your game also revokes the player's Sign in with Apple. Apple accepts a revoke only when it's signed with your key, so MultiConnectCloud needs it to do that when a player deletes their account (section 5, account deletion).
- How to get it: in Apple Developer → Keys, choose +, name it, tick Sign in with Apple, choose Configure and pick your app as the primary App ID, then Continue, Register and Download (
AuthKey_….p8; Apple lets you download it only once). - Where it goes: Team id (top right of the developer site), Key id (shown with the key), Client id (your bundle id) and the .p8 key (paste the file's contents).
- How it's used: only to revoke Apple sign-in when a player deletes their account. It's stored encrypted and never shown again. For it to work, pass Apple's authorization code at sign-in (
SignInWithAppleAsync(identityToken, authorizationCode, …)).
Sign in with email
Two steps: send the code, then sign in with what the player types.
Script 5.1: Email sign-in
using System.Threading.Tasks;
using MultiConnect.App;
using UnityEngine;
public static class EmailSignIn
{
public static async Task<bool> SendCode(string email)
{
var sent = await McAppAuth.SendEmailCodeAsync(email);
if (!sent.Ok) Debug.Log("Could not send the code: " + sent.Message);
return sent.Ok;
}
public static async Task<bool> SignIn(string email, string code)
{
var result = await McAppAuth.SignInWithEmailCodeAsync(email, code);
if (!result.Ok)
{
// CodeInvalid: wrong or expired code. RateLimited: too many tries.
Debug.Log("Sign-in failed: " + result.Message);
return false;
}
Debug.Log("Signed in as " + result.Value?.playerId);
return true;
}
}
A code is valid for 10 minutes. An address can be sent at most 3 codes in 15 minutes.
Sign in with Google or Apple
MultiConnectSDK doesn't show Google's or Apple's sign-in window. Use the sign-in plugin you already use for that platform:
- The plugin returns a token.
- Pass the token to MultiConnectSDK.
- MultiConnectCloud checks the token with Google or Apple before signing the player in.
| Platform | Token to pass | Call |
|---|---|---|
| The ID token, requested for the Web client id you entered on the dashboard | McAppAuth.SignInWithGoogleAsync(idToken) |
|
| Apple | The identity token. Also pass the authorization code when you have one, and the name Apple gives on the first sign-in only | McAppAuth.SignInWithAppleAsync(identityToken, authorizationCode, displayName) |
Link a sign-in method to the current player
Linking adds Google, Apple or email to the player who is signed in, usually a guest. The calls are McAppAuth.LinkGoogleAsync(idToken), McAppAuth.LinkAppleAsync(identityToken, authorizationCode), and McAppAuth.LinkEmailAsync(email, code) after SendEmailCodeAsync.
When the account already belongs to someone else. A player may already have used that Google account on another device. The link is then refused:
ErrorisIdentityInUse;Conflictholds the other player'sdisplayNameandlastSeenAt.
Ask the player whether to continue as that player. If they say yes, call McAppAuth.SwitchAccountAsync(conflict) within 10 minutes. This device then signs in as the other player. The guest's progress stays on the guest account; it isn't merged.
Script 5.2: Link Google, and offer to switch on a conflict
using System.Threading.Tasks;
using MultiConnect.App;
using UnityEngine;
public static class AccountLinking
{
/// <param name="googleIdToken">The ID token from your Google Sign-In plugin.</param>
public static async Task LinkGoogle(string googleIdToken)
{
var link = await McAppAuth.LinkGoogleAsync(googleIdToken);
if (link.Ok)
{
Debug.Log("Google is linked. Progress is safe on any device.");
return;
}
if (link.Error == McAppError.IdentityInUse && link.Conflict != null)
{
// Show "This Google account belongs to <name>. Continue as <name>?"
bool playerSaidYes = await AskPlayer("Continue as " + link.Conflict.displayName + "?");
if (playerSaidYes)
{
var switched = await McAppAuth.SwitchAccountAsync(link.Conflict);
Debug.Log(switched.Ok ? "Now playing as " + switched.Value?.displayName : switched.Message);
}
return;
}
Debug.Log("Could not link: " + link.Message);
}
// Replace with your own dialog.
private static Task<bool> AskPlayer(string question)
{
Debug.Log(question);
return Task.FromResult(true);
}
}
After a successful switch, reload anything your game shows about the player: their wallet, save and name.
Remove a method: McAppAuth.UnlinkAsync("google") (or "apple", "email"). It is refused when it would leave the player with no way to sign in.
Profile, sign-out and account deletion
| Call | What it does |
|---|---|
McAppAuth.UpdateProfileAsync(displayName, avatarId) |
Sets the name (up to 32 characters) and your game's own avatar id |
McAppAuth.GetPlayerAsync() |
Reads the player again, for example after a dashboard change |
McAppAuth.SignOutAsync(allDevices) |
Signs out on this device, or on every device. A guest without a linked method can still return on this device, because it keeps its guest identity |
McAppAuth.DeleteAccountAsync() |
Deletes the player: sign-in methods, saves, scores, wallet, inbox and push tokens. The next start on this device is a new player. The App Store and Google Play require games with accounts to offer this |
McApp.Player.identities lists the linked methods. McApp.Player.HasProvider("google") tells you whether one is linked, so you can hide a "Link Google" button.
Custom sign-in
Who it's for: games that keep their own login system. Your game API checks the player in its own way, then tells MultiConnectCloud who they are.
Flow:
- Your game API calls
McAppServer.SignInCustomAsync(subject, displayName, platform, email):subjectis your own user id for the player. The same subject is always the same player, and the dashboard shows it as the player's Game id.displayNameis the name your game shows. Pass it every time: MultiConnectCloud keeps the player's name in step with it, so the dashboard and leaderboards show the current one.emailis optional: the player's email in your own login, so the dashboard can show and find it.
- It sends the returned session token to the client.
- The client calls
McAppAuth.UseSessionTokenAsync(token).
Between sign-ins, when a player renames or links an account in your game, your server can send the change at once with McAppServer.UpdatePlayerAsync(playerId, displayName, avatarId, email). Values left empty are not changed. When the player unlinks the account the email came from, remove it with clearEmail: true.
This needs Custom turned on and a server credential (section 6).
The Players page
On the app page, Players lists every player. Search by name, email, MultiConnectCloud player id, or, if your game uses custom sign-in, your game's own id for the player (an exact match: 2 finds only player 2). Games with custom sign-in also get a Game id column.
Opening a player shows:
- their Player id (the id every
McAppServercall and the Inbox and Push pages ask for) and, for custom sign-in, Your game's id, each with a Copy button; - their sign-in methods and devices;
- Contact this player: send them a message or gift for their inbox now, and, once push is set up (section 15) and they have a registered device, a push notification. It shows how many devices they have registered, and why push isn't offered when it can't reach them;
- their wallet, which you can give to or take back from;
- their scores this period;
- their cloud save, which you can edit.
It also has Ban (with a reason shown to the player, and an optional end), Sign out everywhere and Delete.
The Activity tab on a player's page is for when a player reports a problem and you need to see what happened on their device.
| Part | What it shows |
|---|---|
| Devices | Each install the player has used: platform, app version and country, with when it was first and last seen. A device is recorded at the player's next sign-in or game launch |
| Activity | The player's analytics events and errors together, newest first. Narrow it to events or to errors, or pick one Event. An error opens to show its Stack and the Log before the error, with Open this error to go to its group on the Errors page |
Three things to know when reading it:
- Events are recorded per device, not per player. On a device that two players share, each player's Activity shows events from both.
- Nothing new appears while Collect analytics or error reports are turned off for the app; the tab says so.
- A player who signs in through custom sign-in shows devices only once the game ships a current MultiConnectSDK.
The same information is available from the MultiConnect CLI: multiconnect app players activity <player-id>.

