Skip to main content
MaihueGO and the web apps offer three providers: Google, Apple and Microsoft. Supabase Auth is the OAuth client towards each provider; horizon-api wraps the flow, creates the profile when needed and issues the session. Each provider appears only when its flag is on. Console configuration is in Rollout and the Apple token lifecycle in Apple: tokens and notifications.
On the left, the native Apple flow on iOS: Sign in with Apple button, Apple returns the identity token and the authorization code, the app sends them with the nonce to POST /api/v3/auth/login/oauth/apple, horizon-api signs in to Supabase with signInWithIdToken and stores Apple's refresh token encrypted. On the right, the browser flow for Android and the web: the app or the web starts the flow, Supabase authorize and the provider consent, the Supabase and horizon-api callbacks, the return to the app deep link or to horizon-authenticate, and oauth/complete. Each provider only appears when its flag is on.

Two ways to sign in with a provider

Behaviour per platform

1

Nonce

The app generates a random nonce with expo-crypto and sends its SHA-256 to Apple.
2

Native sheet

Apple returns identity_token, authorization_code and, only on the first authorization, the first and last name.
3

horizon-api

The app calls POST /api/v3/auth/login/oauth/apple with the raw nonce. horizon-api signs in with signInWithIdToken, exchanges the authorization_code and stores the refresh token encrypted.
4

Result

Existing account → Home. New login → registration without a password (see Registration).
The Apple button has the same height and width as the Google one; the old “Apple no disponible” toast is gone.
  • Buttons are always ordered Google, Apple, Microsoft, and only the enabled ones are shown, packed together with no gaps.
  • The 240 pt slot is held even when there are no buttons, so the screen does not jump.
  • With every provider off, the block stays mounted at opacity:0, is not tappable and is hidden from screen readers.
  • While a sign-in is in progress, every button is disabled.
  • During sign-in an “entering the app” overlay is shown. Home, the courtesy screen, the Android back button or a 20-second failsafe timer dismiss it.

Per-provider flags

One flag applies to every platform (ADR 0133). The old keys maihuego-application-oauth-apple, -google and -microsoft are deleted by the Capacidades Sync in Horizon Enterprise; app versions older than 2026.11.3 do not read the new keys and show no provider until the forced update moves them.
  • GET /api/v3/feature-flag/evaluate?category=authenticate (public, answers a key-to-boolean map), on mount and when returning to the foreground, except during an OAuth flow in progress.
  • It stores the last successful evaluate in AsyncStorage; if an evaluate fails, it keeps the previous one. A missing key counts as off.
  • It never sends FEATURE_FLAG_SERVER_TOKEN: only the Accept and Cache-Control: no-store headers.
  • Buttons are hidden without unmounting the block.
horizon-authenticate evaluates on the server and only renders the enabled buttons. horizon-api also filters verify-email’s providers with the same flags (enabledOauthProviders()), which fail closed: an evaluation error counts as off.
A clean install, or the first launch after updating, shows no provider until the first successful evaluate. A flag change shows up at the next evaluate, without shipping anything. If a tester still sees the old state, they should force-close the app and open it again.

Everyday cases

Each callback accepts only a session that holds its provider’s identity (google for Google, azure for Microsoft); app_metadata.provider is not enough.

Endpoint contracts

The start, callback and native Apple routes are public, each with its own rate-limit policy. oauth/register, oauth/complete and oauth/welcome require the session of the login they act on.
In progress. The redirect_url allowlist exists per environment (config/social-login/redirects.<environment>.json) behind the server flag security-social-redirect-enforce (it replaced AUTH_SOCIAL_REDIRECT_ENFORCE in 2026.11.2); with false it only logs. The 2026.11.2 Sync seeds it true in every environment. Making it mandatory is tracked in security-hardening (T-105).

Limits

See also