Skip to the page

Guides · Integrations

Identity providers & sign-in events

Connect Okta, Entra, Auth0 or Keycloak over OIDC, deliver auth emails through custom SMTP and forward sign-in events to webhooks.

API
—
In the schema
ext::auth::Identity

What you’ll build#

You will connect your project’s built-in sign-in to three external services: an OpenID Connect identity provider (Okta, Microsoft Entra, Auth0 or Keycloak), your own SMTP mail server for verification and password-reset emails, and an HTTPS webhook route that forwards sign-up events to your analytics or CRM pipeline.

Unified OIDC identity

External OIDC logins issue standard project sessions without exposing upstream provider tokens.

Each integration is a project configuration setting that requires zero schema changes. Every signed-in user maps to an ext::auth::Identity, and your access policies continue checking global caller.

Before you start#

Sign-in for your app enables authentication and wires the client SDK’s SignIn helper into your application. Complete that setup first so your app name and allowed redirect URLs are configured.

Connect an OpenID Connect issuer#

napalm sign-in provider <project> oidc connects any OpenID Connect issuer. Register a web application in your identity provider’s console first, add your project’s callback URL and copy the client ID and client secret.

Each custom OpenID Connect provider on main bills as an SSO connection at $30 per month, prorated by the day. Built-in OAuth providers (Google, GitHub, Microsoft, Discord and Slack) carry no SSO fee.

Callback URL
https://<your-project-address>/sign-in/callback. Register this exact callback URL in the provider’s application settings.
Application type
Confidential web application. Napalm stores the client secret server-side and never exposes it to browsers.
Issuer URL
Base URL serving /.well-known/openid-configuration. The table below shows each provider’s format.
ProviderIssuer URL
Oktahttps://<org>.okta.com, or a custom authorization server URL https://<org>.okta.com/oauth2/default
Microsoft Entrahttps://login.microsoftonline.com/<tenant-id>/v2.0
Auth0https://<tenant>.auth0.com
Keycloakhttps://<host>/realms/<realm>
Terminal
# Reads the OAuth client secret from NAPALM_CLIENT_SECRETnapalm sign-in provider notes oidc \  --issuer-url https://acme.okta.com \  --display-name "Acme" \  --slug acme \  --client-id <client-id> napalm sign-in show notes

A project supports multiple OIDC issuers distinguished by unique --slug values alongside built-in OAuth providers. Each enabled provider appears in signIn.metadata() so your sign-in screen can render its button automatically.

src/providers.ts
// src/providers.tsimport { signIn } from './napalm' /** Lists enabled sign-in providers alongside each provider's slug and button label. */export const providers = async () => (await signIn.metadata()).providers /** Redirects to the identity provider, which returns users to /signed-in to complete sign-in. */export async function signInWith(provider: string) {  location.assign(await signIn.providerUrl(provider, { redirectTo: `${location.origin}/signed-in` }))}

Upstream provider tokens stay inside Napalm. Your client app holds only the standard Napalm session token.

Write access policies by issuer#

Each Identity row records the OIDC issuer URL that authenticated the user, exposed to access policies as (global caller).issuer. An organization record can store its enterprise issuer URL and admit matching employees automatically without individual invitations. Multi-tenant B2B SaaS builds that policy.

Configure outbound SMTP mail#

Address verifications, password resets and magic links send through the SMTP server you configure on the project.

Terminal
# Reads the SMTP password from NAPALM_SMTP_PASSWORDnapalm sign-in email notes \  --host smtp.resend.com \  --sender "Notes <sign-in@example.com>" \  --username resend # Require email verification once outbound SMTP is configurednapalm sign-in set notes --require-verification
ProviderHostPortUsernamePassword
Resendsmtp.resend.comPort465UsernameresendPasswordResend API key
Postmarksmtp.postmarkapp.comPort587 using --starttlsUsernameServer API tokenPasswordSame server API token
Amazon SESemail-smtp.<region>.amazonaws.comPort465, or 587 using --starttlsUsernameSES SMTP usernamePasswordSES SMTP password
SendGridsmtp.sendgrid.netPort465UsernameapikeyPasswordSendGrid API key
Verified sender domain
Use a --sender address on a domain verified in your mail provider so messages pass SPF and DKIM checks.
Local development
Leave --require-verification off until SMTP is configured. napalm status notes flags a gap if verification is required without a mail server.

Subscribe to sign-in event webhooks#

Subscribe an HTTPS endpoint with napalm sign-in webhooks add to receive JSON notifications whenever someone creates an account, signs in, verifies an email address or requests a one-time token.

Signed auth event webhooks

Napalm signs every raw event body with HMAC-SHA256 under your signing key.

Allow your receiver domain on the branch and export NAPALM_SIGNING_KEY before registering the webhook.

Terminal
# Allow outbound webhooks to reach app.example.comnapalm webhooks hosts notes --add app.example.com # Reads your HMAC signing key from NAPALM_SIGNING_KEYnapalm sign-in webhooks add notes https://app.example.com/hooks/sign-in \  --event IdentityCreated --event EmailVerified

Nine event types cover account creation, sign-in completions, email factors and verification or recovery requests.

EventSent whenAdditional payload fields
IdentityCreatedA new identity is created at sign-up.Additional payload fieldsNone
IdentityAuthenticatedA user completes sign-in.Additional payload fieldsNone
EmailFactorCreatedAn email factor is attached to an identity.Additional payload fieldsemail_factor_id
EmailVerifiedAn email address is confirmed.Additional payload fieldsemail_factor_id
OneTimeCodeVerifiedA verification, password-reset or magic-link code is redeemed.Additional payload fieldsemail_factor_id, otc_id
EmailVerificationRequestedAn email verification link is requested.Additional payload fieldsemail_factor_id, verification_token
PasswordResetRequestedA password-reset link is requested.Additional payload fieldsemail_factor_id, reset_token
MagicLinkRequestedA magic link is requested.Additional payload fieldsemail_factor_id, magic_link_token, magic_link_url
OneTimeCodeRequestedA one-time verification, reset or magic-link code is requested.Additional payload fieldsemail_factor_id, otc_id, one_time_code
Best-effort delivery
Napalm sends each sign-in event once without automatic retries. Use event webhooks for analytics or custom mailers rather than required user-row creation, and initialize user profile rows in an application query at first sign-in instead.
Identity ID only
Event payloads identify the user by identity_id and omit email addresses and display names.
Replacing a URL
--replace <url> updates an existing destination in place. Because signing keys are write-only, pass NAPALM_SIGNING_KEY again on every update.

Verify and handle events#

Verify x-ext-auth-signature-sha256 against the raw request bytes in constant time with crypto.subtle.verify before parsing JSON, since re-serializing a parsed body alters whitespace and breaks the digest.

An incoming event
POST /hooks/sign-in HTTP/1.1Content-Type: application/jsonx-ext-auth-signature-sha256: 5d41402abc4b2a76b9719d911017c592… {"event_type":"IdentityCreated","event_id":"6b1a7d8e-9f00-4a2b-8c4d-5e6f0192c3f4", "timestamp":"2026-11-10T08:00:00+00:00","identity_id":"8f2c1e64-0b7a-4f4e-9d2b-3a6c5e1f7d90"}
src/app/hooks/sign-in/route.ts
// src/app/hooks/sign-in/route.tsimport { analytics } from '@/lib/analytics' type SignInEvent = { event_type: string; event_id: string; timestamp: string; identity_id: string } /** Verifies the hex HMAC-SHA256 signature over the raw event payload. */async function isFromSignIn(body: ArrayBuffer, signature: string | null) {  if (!signature || !/^[0-9a-f]{64}$/.test(signature)) return false  const key = await crypto.subtle.importKey(    'raw',    new TextEncoder().encode(process.env.NAPALM_SIGNING_KEY!),    { name: 'HMAC', hash: 'SHA-256' },    false,    ['verify'],  )  const signed = Uint8Array.from(signature.match(/../g)!, (pair) => parseInt(pair, 16))  // crypto.subtle.verify compares digests in constant time.  return crypto.subtle.verify('HMAC', key, signed, body)} export async function POST(request: Request) {  // Read the raw bytes first so JSON parsing never alters the signed payload.  const body = await request.arrayBuffer()  if (!(await isFromSignIn(body, request.headers.get('x-ext-auth-signature-sha256')))) {    return new Response(null, { status: 401 })  }  const event = JSON.parse(new TextDecoder().decode(body)) as SignInEvent  if (event.event_type === 'IdentityCreated') {    // identity_id matches the user's ext::auth::Identity ID across your schema.    await analytics.track(event.identity_id, 'signed_up', { id: event.event_id, time: event.timestamp })  }  return new Response(null, { status: 204 })}

The header carries the body’s HMAC-SHA256 digest under your signing key as lowercase hex without a prefix. Sign-in events use a separate signature header from change-log webhooks, which sign with Napalm-Signature.

Check the identity setup#

Verify the OIDC provider, outbound SMTP sender and signed webhook receiver together before opening sign-in to production users.

  1. Inspect the sign-in configuration

    napalm sign-in show notes lists the OIDC issuer slug, SMTP status and each webhook destination alongside its subscribed events without exposing secrets.

  2. Sign in through the OIDC provider

    Click the new provider button on your sign-in page. Completing the handshake redirects to /signed-in with an active session, and querying (global caller).issuer returns the issuer URL.

  3. Request a password reset

    Confirm the reset email arrives from your verified sender domain through your SMTP provider.

  4. Register a new user

    Confirm Napalm posts one IdentityCreated event to your webhook route, and verify that posting a tampered signature returns 401.

Sign-in documents the underlying HTTP endpoints, and Projects API manages the same settings programmatically.

Type a word or two to search every docs page.