Authaz logoAuthaz
DocumentationAPI Reference
  • Get Started

    • Authaz
    • Core Concepts
    • Set up your app
    • Quickstart — cURL
  • Authentication

    • Authentication Settings
    • Signup
    • Invitations
    • Password Authentication
    • Multi-Factor Auth
    • Magic Link
    • OAuth / Social Login
    • Passkey (WebAuthn)
    • SAML SSO
    • Machine-to-Machine (M2M)
    • API Keys
  • Authorization

    • Authorization
    • Resources
    • Policies
    • Roles
    • Access Explorer
  • Tenancy

    • Multi-tenancy
    • Tenancy Customization
  • Brand & Host

    • Branding
    • Custom Domains
    • Communications & Email Templates
  • Operate

    • Users
    • Analytics
    • Audit Logs
    • Application Settings
  • SDK Quickstarts

    • Quickstart — Next.js
    • Quickstart — React SPA
    • Quickstart — Hono
    • Quickstart — .NET (Authaz.Sdk)
  • Recipes

    • Recipes & Cookbook
    • Next.js — first integration
    • Next.js — B2B SaaS (multi-tenant)
    • Hono — first integration
    • Hono — B2B SaaS (multi-tenant)
    • React SPA — first integration
    • React SPA — B2B SaaS (multi-tenant)
    • .NET — first integration
    • .NET — B2B SaaS (multi-tenant)
  • Reference

    • Tokens
    • API Reference
    • Errors & Troubleshooting
  • Documentation

    • How Authaz is Built
  1. Authaz
  2. Docs
  3. Authentication
  4. OAuth / Social Login

Authentication

OAuth / Social Login

4 min read·Updated Jun 19, 2026

Let users sign in with an account they already have. Authaz Sign-In shows a button per provider you've enabled, and the rest happens behind the scenes.

Use it in your app. Once a provider is configured, its button appears on Authaz Sign-In automatically — your app code doesn't change. The standard sign-in flow (Next.js · React · Hono · cURL) returns the same OAuth tokens regardless of which social provider the user picked.

# Enable Google for an application
curl -X POST https://your-app.authaz.io/api/v1/applications/{appId}/auth/oauth \
  -H "X-API-Key: $AUTHAZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "google",
    "clientId": "GOOGLE_OAUTH_CLIENT_ID.apps.googleusercontent.com",
    "clientSecret": "GOCSPX-...",
    "scopes": ["openid", "email", "profile"]
  }'

Supported providers

Previous
Magic Link
Next
Passkey (WebAuthn)
#
ProviderNotes
GoogleStandard OAuth 2.0 + OIDC. Most common pick.
MicrosoftAzure AD / Entra ID. Works with consumer (@outlook.com) and work/school accounts.
GitHubOAuth 2.0; emails come from the user:email scope.
AppleSign in with Apple. Requires JWT-signed client secret — see below.

You can enable any combination per application. Users with the same email across providers are merged into a single Authaz user.

Setup (3 steps)#

1. Create OAuth credentials with the provider#

Each provider has its own dashboard:

  • Google → Google Cloud Console → OAuth client ID.
  • Microsoft → Azure Portal → App registrations.
  • GitHub → Settings → Developer settings → OAuth Apps.
  • Apple → Apple Developer → Services ID + Sign in with Apple.

You'll get back a Client ID and a Client Secret (or, for Apple, the components needed to mint a signed JWT).

2. Tell the provider where to redirect#

Each provider needs an authorized redirect URI. Use:

https://your-app.authaz.io/auth/oauth/{provider}/callback

…with {provider} replaced by google, microsoft, github, or apple. If you've set up a custom domain (auth.yourapp.com), use that hostname instead.

3. Configure it in Authaz#

Dashboard → Application → Authentication → OAuth → Add provider, paste the credentials, save. Or via the API:

curl -X POST https://your-app.authaz.io/api/v1/applications/{appId}/auth/oauth \
  -H "X-API-Key: $AUTHAZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "github",
    "clientId": "Iv1.abcdef...",
    "clientSecret": "ghp_...",
    "scopes": ["read:user", "user:email"]
  }'

The provider button now shows up on Authaz Sign-In automatically.

How it works#

  1. User clicks Sign in with Google on Authaz Sign-In.
  2. Authaz redirects to Google's consent screen.
  3. Google returns to Authaz at /auth/oauth/google/callback?code=....
  4. Authaz exchanges that code with Google for an ID token, reads the email and profile.
  5. Authaz creates (or finds) the user, then redirects back to your app with an Authaz authorization code.
  6. Your backend exchanges the Authaz code for tokens — same as the password flow.

The user's social provider only ever talks to Authaz. Your app sees a normal OAuth 2.0 + PKCE flow against Authaz, regardless of which provider the user picked.

Account linking#

If a user signs in with Google using you@example.com, then later signs in with GitHub using the same verified email, Authaz links them into a single user record by default. Their access token's sub is stable across both methods.

You can opt out of automatic linking per application — pass linkAccountsByEmail: false in the application's config — in which case the second provider creates a fresh user.

Apple (special case)#

Apple is the only provider that requires a signed JWT as the client secret. You don't paste a static string; you paste the components Apple expects:

  • Team ID
  • Services ID (acts as the client ID)
  • Key ID
  • Private key (.p8 file contents)

Authaz mints a fresh client secret JWT for each token exchange and rotates it automatically. There's no expiry to track.

Multi-tenant: per-tenant OAuth#

If your application is multi-tenant, each tenant can have its own OAuth provider config — useful when one tenant uses their own Google Workspace OAuth app:

curl -X POST https://your-app.authaz.io/api/v1/applications/{appId}/tenants/{tenantId}/auth/oauth \
  -H "X-API-Key: $AUTHAZ_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "google",
    "clientId": "TENANT_GOOGLE_CLIENT_ID.apps.googleusercontent.com",
    "clientSecret": "GOCSPX-..."
  }'

Authaz picks the tenant-specific config when the user is signing into that tenant; otherwise it falls back to the application-level config.

Scopes and what you get#

Authaz only asks the social provider for the scopes you configure. Email and profile are usually enough; request more (e.g. https://www.googleapis.com/auth/calendar.readonly) only if your app actually needs them.

The user's scope decisions are visible in the OIDC id_token returned to your app — you can read claims like email, name, picture directly without an extra round-trip.

Next steps#

  • Password — typically enabled alongside social as a fallback.
  • Magic Link — another passwordless option.
  • cURL quickstart — the OAuth flow against Authaz itself.