# Managing Social OAuth Across Thousands of Accounts

> Tokens that expire on different clocks, scopes that drift, revocations nobody announces, and one grant that reaches many accounts. What it takes to keep thousands of connections working.

Connecting one social account is an afternoon's work. Keeping ten thousand of them working, across platforms, for customers whose own customers did the authorizing, is an operations problem: tokens expire on different clocks, scopes drift, revocations arrive unannounced, and one grant can reach many accounts.

## Every platform runs its own clock

- **LinkedIn** grants last 60 days, or 365 with refresh tokens, and then expire for good: only the member reconnecting renews them. Changing the scopes your app requests later invalidates every existing token.
- **Meta** issues a user token, but Page calls run on a Page token derived from it, so a Facebook or Instagram connection is really two credentials.
- **YouTube** grants from an app still in Google's "Testing" state expire after seven days, which surprises everyone the first week in production.
- **Any platform** can lose a grant when the user revokes access. Nothing tells you; the next refresh fails.

At scale, some of these are always in flight. The question isn't whether a connection breaks but how quickly anyone notices.

## Make every failure an event

The pattern that works is to check before every call and report every failure:

- **Refresh before use, and check scopes before calling the platform.** An operation the grant can't support should fail with the missing scope's name before it reaches the platform, not as a platform error halfway through a publish.
- **Turn a failing refresh into an event.** When a refresh fails, emit something your product can show: "this client's Instagram needs reconnecting." Koil emits `connection.updated` when a Connection needs its user again, ahead of an expiry where it can, and reports Connection health on the API.
- **Expire what's dead, on a schedule you can defend.** A Connection whose refresh still fails six days later is deleted, inside the seven days YouTube allows after a revocation.

## One grant, many accounts

Grants and accounts aren't one-to-one, and treating them that way creates duplicates and wrong-account actions:

- **A Google Business Profile grant** discovers every location under every account it manages; a chain connects all its stores at once.
- **A LinkedIn member** with admin roles connects all of their organization Pages in one consent.
- **An Instagram account** is reached through the Facebook Page it's linked to.

Model the grant (a Connection) separately from each account it reaches (a Profile), and make every operation name the profile it acts on. Then nothing runs against the wrong account, and an unknown profile is an error instead of an empty result.

## Whose app the grants belong to

Every one of these grants is issued to some app. If it's a vendor's shared app, the consent screen shows the vendor's name, the quota is shared with every other tenant, and one tenant's policy strike can suspend everyone. If it's your own app, the grants belong to you: your brand on the consent screen, your quota, and no reconnecting your users if you change vendors.

Koil runs every connection on your own app, and you can import grants you already hold, and export them, so adopting it doesn't mean asking anyone to reconnect.

## Build before review finishes

The cost of your own app is platform review: Meta's for messaging permissions, LinkedIn's Standard Tier, Google's OAuth verification. Building against a sandbox with simulated platforms lets the integration be done before review is.

[How Koil manages connections →](https://koil.co/product/white-label-oauth/)

## Related

- [White-Label OAuth](https://koil.co/product/white-label-oauth/)
- [Use case: Agencies & Franchises](https://koil.co/use-cases/agencies-and-franchises/)
