# Google Sign-In across seven Unity platforms, one API

> Android, iOS, WebGL, Windows, macOS, UWP, Editor. A tour of Universal Google Sign-In — the plugin that collapses seven OAuth flows into one Unity API.

By Ahmed Qaddoura, 2025-05-21.

## Seven platforms, seven OAuth flows, one method

Google Sign-In is an interesting case study in platform fragmentation. The underlying protocol is the same — OAuth 2.0 — but every platform has its own approved flow:

- **Android** wants Google Play Services. Pass a Web Client ID, let Play Services pick up the Android Client ID from the keystore signature.
- **iOS** wants `ASWebAuthenticationSession` with a deep-link callback.
- **macOS / UWP** want the system browser, also with a deep link.
- **Windows / Editor** want a loopback HTTP server.
- **WebGL** wants the JavaScript implicit flow.

Each of these is *its own* SDK, with its own setup dance in Google Cloud Console. If you build all seven in isolation, you end up with seven ways to call `SignIn()` in your game — and seven sets of bugs.

We built Universal Google Sign-In to hide all of that behind a single method. Call `UniversalGSignIn.Init(CLIENT_ID, OnReady)` in Unity. Call `UniversalGSignIn.SignIn(OnUser)` when the user taps the button. The right flow runs on the right platform. You get the same `GoogleUser` struct back regardless.

## What the integration looks like in practice

```csharp
void Start() {
    UniversalGSignIn.Init(WEB_CLIENT_ID, ready => {
        if (ready && UniversalGSignIn.IsSignedIn()) {
            ShowHome(UniversalGSignIn.GetCurrentUserBasicProfile());
        } else {
            signInButton.SetActive(true);
        }
    });
}

public void OnSignInTapped() {
    UniversalGSignIn.SignIn(user => {
        if (!string.IsNullOrEmpty(user.error)) {
            ShowError(user.error);
            return;
        }
        ShowHome(user.basicProfile);
    });
}
```

That's the whole integration. The Init call can accept an optional `urlScheme` (for iOS / macOS / UWP), `clientSecret` (for loopback on desktop), and `loopbackLink` (to pick a free port). Everything else is auto-detected per platform.

## What still requires per-platform work

We don't paper over everything. Google still needs you to create the right client IDs in the Cloud Console — Web for Android/WebGL, iOS for deep-link platforms, Desktop for loopback. And you still need to configure deep links in Unity if you target iOS / macOS / UWP.

But once that setup is done once, the code is the code. No `#if UNITY_ANDROID` branches. No separate user structs per platform.

## Why we charge $4.99

The plugin is a one-time purchase. No subscriptions, no seat counts, no usage caps. $4.99 buys you the source on your disk, the rights to ship it, and the future updates. If the native SDKs change — and they do, every year — we absorb that work so your game build doesn't break.

The listing is [here](https://assetstore.unity.com/packages/slug/293326). Source for open inspection is on [GitHub](https://github.com/simple-yet-efficient/google-sign-in).

If your game needs Google authentication and you don't want to become an OAuth expert, that's the deal.
