From your app to a verified session.
Choose a starter with the UI, server routes, and session storage already connected. Your users authenticate with Identiblok and return to your website with a secure session.
- 01
Start in development
Add an application , open Development in Set up AuthID, and create an environment at
http://localhost:3000. Create a server client withhttp://localhost:3000/auth/callbackas its exact callback. No DNS or SAML certificate is needed for localhost. - 02
Start with working code
Download the starter, open
Download both startersnext/, then runnpm install. Copy.env.exampleto.env.localand add the development credentials from your workspace. KeepAUTHID_ENVIRONMENT=developmentfor local HTTP. - 03
Connect a private PostgreSQL database
Run the included schema.sql migration and set DATABASE_URL. Use a database role restricted to this table and a TLS-verified connection. The shared store works across serverless instances.
- 04
Add your UI. Protect your API.
The starter includes sign-in, sign-up, callbacks, session refresh, and sign-out. Use
auth.session(request)in every protected server handler. Start withnpm run dev, then follow the HTTPS setup in the included README.
import "server-only";
import { Pool } from "pg";
import { createAuthID } from "@identiblok/authid-web/server";
import { PostgresStore } from "@identiblok/authid-web/postgres";
function required(name: string) {
const value = process.env[name];
if (!value) throw new Error(`Set ${name} in your server environment.`);
return value;
}
const pool = new Pool({ connectionString: required("DATABASE_URL"), max: 5 });
export const auth = createAuthID({
development: process.env.AUTHID_ENVIRONMENT === "development",
signInOrigin: process.env.AUTHID_SIGN_IN_ORIGIN,
appOrigin: required("APP_ORIGIN"),
clientId: required("AUTHID_CLIENT_ID"),
clientSecret: required("AUTHID_CLIENT_SECRET"),
store: new PostgresStore(pool),
afterSignIn: "/",
});Already have an app? Download the package and install it with npm install ./identiblok-authid-web-0.1.0-alpha.3.tgz. Read the setup guide · Verify download checksums.
Separate development from production.
Each application has Development and Production tabs. Start with localhost and your development client. Users, credentials and permission grants belong to the environment you selected.
AUTHID_ENVIRONMENT=development
APP_ORIGIN=http://localhost:3000
AUTHID_CLIENT_ID=YOUR_DEVELOPMENT_CLIENT_ID
AUTHID_CLIENT_SECRET=YOUR_DEVELOPMENT_CLIENT_SECRETHTTP is allowed only on localhost, 127.0.0.1 or ::1 with development explicitly enabled. Remote development and all production origins require HTTPS and verified DNS. Use separate session databases.
Your production checklist
- Complete a real sign-in through your development integration.
- Verify your production domain and create its server client.
- Verify sign-out and access controls on protected routes.
- Save recovery material and production secrets securely.
- Review blockchain permissions and the single-authority trust model.
Identiblok checks sign-in, DNS and the server client automatically. You confirm the remaining reviews before activating production. Then install production credentials and set AUTHID_ENVIRONMENT to production on your live backend. Test data and grants stay in development.
Ready to embed. Easy to recognize.
Drop in a sign-in card, a sign-up card, or an account menu. Try the actual components below, then copy the React or plain HTML example.
Welcome back
Sign in to Your application.
You’ll continue securely on Identiblok, then return here.
Preview only. No account is created.
Make it yours
"use client";
import { AuthIDProvider, SignIn } from "@identiblok/authid-web/react";
import "@identiblok/authid-web/styles.css";
export default function Account() {
return (
<AuthIDProvider appName={"Your application"}>
<SignIn returnTo="/" />
</AuthIDProvider>
);
}Connect the server routes first. The component handles the interface; your backend verifies the session.
The interface lives on your website. Credential verification and account recovery take place on the hosted AuthID screen, which returns users to your registered callback. Passkeys remain scoped to Identiblok’s authentication domain.
OAuth2, with the providers your users know.
Adapters for 13 providers are included, using OpenID Connect where supported and a verified provider account ID otherwise. Your application uses the same Identiblok session regardless of the upstream provider.
Register an OAuth application with Google and use this exact callback:
https://auth.identiblok.com/auth/social/google/callbackRequested scopes: openid. Credentials are configured by the Identiblok service operator. A provider appears in hosted sign-in only after it is configured.
One identity. Explicit account linking.
New social users finish by creating a passkey and saving a recovery kit. Existing AuthID users verify their passkey before linking another provider. Later they can sign in with that linked provider. Matching email addresses never merge accounts automatically. Recovery removes existing links.
Keep the session on your server.
The web SDK uses authorization code flow with PKCE, validates signed identity tokens, and stores tokens in your database. The browser receives an opaque, Secure, HttpOnly session cookie. Access tokens refresh under a shared lock, and server session checks verify current AuthID access.
import { auth } from "@/lib/auth";
export async function GET(request: Request) {
try {
const session = await auth.session(request);
if (!session) return Response.json({ error: "Sign in required" }, { status: 401 });
return Response.json({ userId: session.user.id }, {
headers: { "Cache-Control": "no-store" }
});
} catch {
return Response.json({ error: "Authentication temporarily unavailable" }, { status: 503 });
}
}SignedIn and SignedOut control what appears on screen. Every protected server route still needs its own session check. Sessions last at most 12 hours; sign-out removes this website’s session and attempts to revoke its refresh token. It does not sign out every application.
Authentication and authorization, together.
Authentication establishes which AuthID a person controls. Authorization decides what that identity can do in your application. Identiblok combines passkey sign-in with a signed permission ledger.
Your developer account manages application settings. It is separate from the AuthID your website’s users will use to sign in.
Add an applicationYour users’ identity is their AuthID.
An AuthID is a stable identifier bound to passkeys. Identiblok stores public credential keys; users’ private signing keys and biometric data stay with their authenticators. Device providers may synchronize passkeys according to their own settings.
Enrollment creates a one-use recovery kit. Recovery requires that kit and a new passkey, preserves the AuthID, replaces credentials and linked sign-in methods, and invalidates existing sessions. It does not grant new application permissions.
Create an AuthID before trying to sign in. On a Mac, use Safari or Chrome for Touch ID. To add a physical key later, open Passkeys & devices and select USB or NFC security key. The key must support FIDO2 passkeys and user verification. Embedded browsers may not expose the Mac’s built-in authenticator.
Set up your website.
- Add an application. Save its name, HTTPS origin, and exact sign-in return URL. Wildcards and fragments are not accepted.
- Open Set up AuthID. Choose OpenID Connect for the web SDK. If your application requires SAML instead, provide its entity ID, assertion-consumer URL, and public signing certificate. Your private key stays on your server.
- Verify your domain. Add the supplied DNS TXT record. Keep the record and reverify within 30 days; expired verification denies sign-in and API access.
- Configure the integration. For OIDC, create a client with an exact registered callback on your verified origin. SAML integrations import the application metadata and pin its signing certificate.
- Create a server key. Choose only the API permissions your backend needs. Save the secret when it is shown; it is displayed once.
{
"name": "Your application",
"app_origin": "https://app.example.com",
"redirect_url": "https://app.example.com/auth/callback"
}Complete domain verification and integration setup after saving your application. Keep private signing keys, recovery codes, and passwords out of application settings.
A verified sign-in starts the session.
Use a signed SAML request or an OIDC authorization-code flow with S256 PKCE, state, and nonce. The hosted AuthID flow verifies the person and asks them to approve access to your application.
Your server validates the response and creates its own protected application session. An AuthID supplied in an untrusted browser request is never sufficient proof of identity.
- OpenID Connect discovery
- View the discovery document
- SAML metadata
- Copy the application-specific metadata URL from Set up AuthID in your workspace.
- Node SDK
- The MIT-licensed server SDK validates SAML signatures and transaction binding, and verifies signed permission decisions. Install it with
npm install @identiblok/authid. Read the SDK setup guide.
Exchange OIDC codes on your backend and obtain user consent through hosted sign-in. Your application manages its own session and clears it on logout.
Use the language you already know.
Choose an integration and language. These backend modules show the complete SDK calls; connect their functions to your framework’s login, callback, and protected-action handlers.
Confidential backend client, using openid-client for OIDC. Register the exact HTTPS callback without query parameters. Download the SQLite transaction adapter alongside this module.
npm install openid-client@^6import * as oidc from 'openid-client';
import { createHash, randomBytes } from 'node:crypto';
import { SQLiteTransactions } from './sqlite-transactions.mjs';
const clientId = process.env.AUTHID_OIDC_CLIENT_ID;
const callback = process.env.AUTHID_OIDC_REDIRECT_URI;
const config = await oidc.discovery(new URL('https://auth.identiblok.com'), clientId,
process.env.AUTHID_OIDC_CLIENT_SECRET, oidc.ClientSecretBasic(),
{ execute: [oidc.enableNonRepudiationChecks] });
const store = new SQLiteTransactions(process.env.AUTHID_STATE_DB);
const prefix = 'oidc:' + clientId + ':';
function bind(value) {
if (!/^[A-Za-z0-9_-]{43}$/.test(value)) throw new Error('Invalid browser binding');
return createHash('sha256').update(value).digest('hex');
}
export async function beginLogin(browserBinding) {
const state = oidc.randomState(), nonce = oidc.randomNonce();
const verifier = oidc.randomPKCECodeVerifier();
const saved = JSON.stringify({ binding: bind(browserBinding), nonce, verifier });
if (!await store.put(prefix + state, saved, 300)) throw new Error('Storage unavailable');
return oidc.buildAuthorizationUrl(config, { redirect_uri: callback, scope: 'openid profile',
state, nonce, code_challenge: await oidc.calculatePKCECodeChallenge(verifier),
code_challenge_method: 'S256' }).href;
}
export async function finishLogin(callbackUrl, browserBinding) {
const url = new URL(callbackUrl), expected = new URL(callback);
if (url.origin !== expected.origin || url.pathname !== expected.pathname || url.hash)
throw new Error('Wrong callback');
if (url.searchParams.getAll('state').length !== 1) throw new Error('Invalid state');
const state = url.searchParams.get('state');
const saved = await store.get(prefix + state);
if (!saved) throw new Error('Expired sign-in');
const tx = JSON.parse(saved);
if (tx.binding !== bind(browserBinding)) throw new Error('Wrong browser');
if (await store.take(prefix + state) !== saved) throw new Error('Already consumed');
const tokens = await oidc.authorizationCodeGrant(config, url, {
pkceCodeVerifier: tx.verifier, expectedState: state,
expectedNonce: tx.nonce, idTokenExpected: true,
});
const claims = tokens.claims();
if (!claims || !/^ibk_[a-f0-9]{64}$/.test(claims.sub)) throw new Error('Invalid AuthID');
return claims.sub;
}
export function newBrowserBinding() { return randomBytes(32).toString('base64url'); }Keep each login tied to its browser.
- Generate a random 32-byte base64url browser binding. Save it in a dedicated
__Host-authid-txcookie withSecure,HttpOnly,Path=/, and a five-minute lifetime. UseSameSite=Nonefor SAML’s cross-site POST callback;Laxworks for OIDC’s top-level GET callback. Do not set a cookie domain. - Pass that cookie value to both login functions. Redirect to the URL returned by the begin function. Never accept the binding from a query or form field.
- At the callback, reject missing cookies, duplicate form/query parameters, and oversized requests. Give the complete callback URL to OIDC, or the two POST fields to SAML. A verification error must end the login.
- After successful verification, delete the transaction cookie and rotate your application session ID. Store the returned AuthID in that server session. Use a separate secure session cookie and your framework’s CSRF protection for application actions.
The SQLite and file adapters require persistent storage on one host. For Vercel or multiple replicas, provide a shared database implementation with atomic insert, consume, and checkpoint updates. Never use an in-memory store or an ephemeral filesystem for these records.
Download the native SDKs.
Download the Python, Ruby, and Rust packages below for SAML, OIDC, and signed permission verification. Each package includes installation instructions and version information.
- Python wheel · Python source and README
- Ruby gem · Ruby source and README
- Rust source and README — unzip next to your project and use the path dependency shown above.
- Download checksums · Setup and storage contract
Check access before every protected action.
The permission API evaluates grants and roles within your application. The AuthID must be active and have joined your app. Organization-scoped permissions also require current membership.
POST https://auth.identiblok.com/v1/permissions/check
Authorization: Bearer YOUR_SERVER_API_KEY
Content-Type: application/json
{
"subject": "AUTHID_FROM_VERIFIED_SESSION",
"permission": "documents.read",
"nonce": "FRESH_32_BYTE_BASE64URL_NONCE"
}Use a server key with the permissions:read scope. Take the subject from a verified server session. Never place your API key in browser code or a public environment variable.
Decisions carry a signed receipt bound to the application, subject, permission, resource, organization, nonce, and chain state. Verify the signature and freshness with pinned network and authority keys. Receipts expire after 15 seconds. Deny access on failed, stale, or unavailable checks.
Import IDENTIBLOK_MAINNET from @identiblok/authid/networks and configure a durable checkpoint store. The package includes a file store for persistent Linux and macOS servers; serverless and multi-host applications need a shared database store. Never store production checkpoints on an ephemeral deployment filesystem.
Download the public network trust anchor. The SDK checks this pinned authority and denies older or conflicting permission history against your saved checkpoints. A change of authority requires an explicit trust update.
Identity and access for your application.
Connect sign-in, manage customer organizations, and control access through your workspace and server integrations.
- Developer workspace
- Manage projects, environments, team access, domains, and server credentials.
- Keep development and production configuration separate within a shared workspace.
- Passkeys and account recovery
- Give users an AuthID with passkey sign-in, additional devices, and a one-use recovery kit.
- Private signing keys stay with the user’s authenticators. Account recovery preserves their AuthID and revokes existing sessions.
- Sign-in and verification
- Use email codes and links, linked passwords, authenticator codes, and passkey verification.
- Require additional verification for sensitive account actions and manage linked sign-in methods.
- Users and organizations
- Manage application profiles, memberships, invitations, devices, and sessions.
- Organize customer teams and control their access independently of each person’s AuthID.
- Roles and permissions
- Define roles and scoped grants, revoke access, and verify signed permission decisions.
- Check access from your server for the specific application, organization, and resource.
- SAML and OpenID Connect
- Connect your application to AuthID using SAML or OIDC authorization code flow with PKCE.
- Register exact callbacks and validate identity on your server before creating an application session.
- Enterprise SSO
- Connect customer identity providers through organization-specific SAML and OIDC connections.
- Manage enrollment, identity mapping, MFA trust, certificate rotation, and SSO requirements for each organization.
- Embedded components and SDKs
- Add React or HTML sign-in and account controls, with server integrations for Node.js, Python, Ruby, and Rust.
- Use the language guides and downloadable starters to connect your interface, callbacks, and session storage.
- Events and audit logs
- Follow application activity, deliver signed webhooks, and manage customer audit records.
- Review delivery history, replay events, configure retention, and export audit records.
- Feature entitlements
- Define application features, usage limits, and access entitlements.
- Check feature access and record usage from your server within the correct application scope.
Build on a clear security model.
Keep credentials on your server, validate every callback, and check permissions before protected actions. Review how Identiblok handles passkeys, sessions, recovery, and signed access decisions.