More ways to sign in¶
A game on otomo signs a player in with their device the first time it runs: there is nothing to type and no account to create. This page explains the other ways in, Steam and Google, and what "linking" them means. The first half is written so you can reuse it in your game's help pages; the second half is for the people building the game.
The setup for operators, and every SDK call in detail, is in Sign in with Steam, Google and other providers.
For players¶
Why sign in with Steam or Google?¶
Your progress belongs to an account. On a new install the game makes an account tied to that computer. That is fine until you change computers, reinstall, or lose the machine: a device account cannot follow you, because the only thing that proves it is yours is a file on that device.
Signing in with Steam or Google ties the account to something you can sign in to anywhere. Sign in with the same Steam or Google account on another computer and you get the same progress.
Linking¶
If you already play with a device account, you do not have to start again. In the game's account or settings screen, choose to link Steam or Google. Your progress stays exactly where it is; from then on you can also sign in with the account you linked.
- You can link one Steam account and one Google account to the same game account.
- A Steam or Google account can belong to only one game account. If it is already linked to another one, the game says so ("This account is already linked to another player") and nothing changes. Accounts are never merged.
- Linking never signs you out.
Unlinking¶
You can remove a way of signing in as long as at least one other way remains. The game will not let you remove the last one, because an account nobody can sign in to is lost.
When you unlink something, the game signs you out everywhere else, but keeps you signed in on the device you are using. That is deliberate: the usual reason to unlink is "that is not mine any more", and the other sessions might not be yours.
If you unlink this device, the next time the game cannot use your saved session it asks you how to sign in, instead of quietly making a new, empty account for this computer.
If you lose your device¶
If you linked Steam or Google, sign in with it on your new device and everything is there. If you only ever played with a device account, the progress was tied to the lost device and cannot be recovered. That is the best reason to link something early.
Deleting your account¶
Deleting your account (from the game's account screen) removes it and everything it signs in with: the device, Steam and Google links all go at once. Your Steam or Google account itself is not touched. If you sign in with the same Steam or Google account afterwards, you start a new, empty account. If you also want to remove the game's access on Google's side, remove the game from the third-party access list in your Google Account's security settings; Steam keeps no standing access to remove.
What the game can see¶
When you sign in with Steam, the game's server learns your SteamID (the number in your public Steam profile address). When you sign in with Google, it learns only an opaque id that Google makes for the game: not your email, your name or your picture. Neither Steam nor Google tells the game your password, and the game never asks for it.
For game developers¶
What to build¶
| Screen | What it does | SDK call |
|---|---|---|
| First launch | Nothing: the device login happens on its own | Otomo.Instance.StartAsync |
| Sign-in choices | "Continue with Steam", "Continue with Google", "Play as guest" | SignInWithSteamAsync, SignInWithGoogleAsync, LoginWithDeviceIdAsync |
| Account screen | List what is linked, link more, unlink, delete the account | GetIdentitiesAsync, LinkSteamAsync, LinkGoogleAsync, UnlinkAsync, AccountClient.DeleteAccountAsync |
Show the sign-in choices when the SDK raises LoggedOut. Once an install has signed in with or
linked Steam or Google, the SDK no longer falls back to a device login by itself (it could make a
new, empty account), so that signal is your cue to ask.
Steam¶
The SDK has no Steamworks dependency. Get the ticket from Steamworks with the identity string your
server uses (otomo-auth unless the operator changed AUTH_STEAM_IDENTITY) and pass its hex:
// After ISteamUser.GetAuthTicketForWebApi("otomo-auth") calls back with the ticket bytes:
await auth.SignInWithSteamAsync(Convert.ToHexString(ticketBytes));
// or, for a player who is already signed in:
await auth.LinkSteamAsync(Convert.ToHexString(ticketBytes));
Ask Steamworks for a fresh ticket for every call: the server accepts each ticket once.
Google¶
The SDK runs the whole desktop sign-in. It opens the player's browser at Google's page, waits on
127.0.0.1 for Google to send the player back, checks that the answer belongs to this sign-in,
shows a page saying the window can be closed, and finishes the sign-in with the server.
// clientId: the OAuth "Desktop app" client id your operator created; the same value as the
// server's AUTH_GOOGLE_CLIENT_ID. It is not a secret.
await auth.SignInWithGoogleAsync(clientId);
var linked = await auth.LinkGoogleAsync(clientId);
The browser opens through AuthClient.BrowserLauncher, the system browser by default. In Godot
you can hand it OS.ShellOpen:
private sealed class GodotBrowser : IBrowserLauncher
{
public void Open(string url) => OS.ShellOpen(url);
}
auth.BrowserLauncher = new GodotBrowser();
The player has BrowserSignInTimeout (5 minutes by default) to finish. Another configured
provider works the same way with SignInWithBrowserAsync(name, authorizationEndpoint, clientId,
scope), provided the operator allowed the loopback redirect for it.
Errors to handle¶
| Code | What to show |
|---|---|
sign_in_cancelled |
Nothing, or "Sign-in cancelled": the player closed or declined the browser page |
state_mismatch, sign_in_failed |
"Sign-in did not finish, try again" |
browser_unavailable |
"Could not open your browser" |
timeout |
"Sign-in timed out, try again" |
invalid_credential |
"That did not work, try again" (get a new Steam ticket) |
identity_taken |
"This account is already linked to another player" |
method_already_linked |
"Unlink your current Steam (or Google) account first" |
last_identity |
"Link another way to sign in before removing this one" |
provider_not_configured |
Hide that button: the server has not set it up |
provider_unavailable |
"Steam (or Google) is not answering, try again soon" |
The first five are local to the SDK (status 0); the rest come from the server and are listed in the error reference.
For operators¶
Steam needs a Steamworks publisher Web API key and the game's app id; Google needs an OAuth
client of type "Desktop app". Until they are set, those buttons answer 503
provider_not_configured and nothing else changes. The steps are in
Sign in with Steam, Google and other providers. Staff can see
what a player has linked on the admin website's player page, under Linked accounts.