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:/. Register this exact callback URL in the provider’s application settings./ <your-project-address>/ sign-in/ callback - Application type
- Confidential web application. Napalm stores the client secret server-side and never exposes it to browsers.
- Issuer URL
- Base URL serving
/. The table below shows each provider’s format..well-known/ openid-configuration
| Provider | Issuer URL |
|---|---|
| Okta | https://<org>.okta.com, or a custom authorization server URL https:/ |
| Microsoft Entra | https:/ |
| Auth0 | https:/ |
| Keycloak | https:/ |
# 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 notesA 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.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.
# 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| Provider | Host | Port | Username | Password |
|---|---|---|---|---|
| Resend | smtp.resend.com | Port465 | Usernameresend | PasswordResend API key |
| Postmark | smtp.postmarkapp.com | Port587 using --starttls | UsernameServer API token | PasswordSame server API token |
| Amazon SES | email-smtp.<region>.amazonaws.com | Port465, or 587 using --starttls | UsernameSES SMTP username | PasswordSES SMTP password |
| SendGrid | smtp.sendgrid.net | Port465 | Usernameapikey | PasswordSendGrid API key |
- Verified sender domain
- Use a
--senderaddress on a domain verified in your mail provider so messages pass SPF and DKIM checks. - Local development
- Leave
--require-verificationoff until SMTP is configured.napalm status notesflags 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.
# 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 EmailVerifiedNine event types cover account creation, sign-in completions, email factors and verification or recovery requests.
| Event | Sent when | Additional payload fields |
|---|---|---|
IdentityCreated | A new identity is created at sign-up. | Additional payload fieldsNone |
IdentityAuthenticated | A user completes sign-in. | Additional payload fieldsNone |
EmailFactorCreated | An email factor is attached to an identity. | Additional payload fieldsemail_factor_id |
EmailVerified | An email address is confirmed. | Additional payload fieldsemail_factor_id |
OneTimeCodeVerified | A verification, password-reset or magic-link code is redeemed. | Additional payload fieldsemail_factor_id, otc_id |
EmailVerificationRequested | An email verification link is requested. | Additional payload fieldsemail_factor_id, verification_token |
PasswordResetRequested | A password-reset link is requested. | Additional payload fieldsemail_factor_id, reset_token |
MagicLinkRequested | A magic link is requested. | Additional payload fieldsemail_factor_id, magic_link_token, magic_link_url |
OneTimeCodeRequested | A 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_idand omit email addresses and display names. - Replacing a URL
--replace <url>updates an existing destination in place. Because signing keys are write-only, passNAPALM_SIGNING_KEYagain 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.
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.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.
Inspect the sign-in configuration
napalm sign-in show noteslists the OIDC issuer slug, SMTP status and each webhook destination alongside its subscribed events without exposing secrets.Sign in through the OIDC provider
Click the new provider button on your sign-in page. Completing the handshake redirects to
/signed-inwith an active session, and querying(global caller).issuerreturns the issuer URL.Request a password reset
Confirm the reset email arrives from your verified sender domain through your SMTP provider.
Register a new user
Confirm Napalm posts one
IdentityCreatedevent to your webhook route, and verify that posting a tampered signature returns401.
Sign-in documents the underlying HTTP endpoints, and Projects API manages the same settings programmatically.