Skip to content

Repository files navigation

NamoID examples

License: MIT

Official, runnable integrations for NamoID. Examples are organized by integration model first, then framework, so standards-based OAuth, OpenID Connect, Workforce SSO, and Agent Access can be added without mixing their configuration or security models.

The public examples directory is designed for examples.namoid.in. Follow HOSTING.md to deploy it and the first demos from this repository using free hosting services.

Available now: Hosted Auth

Hosted Auth gives developers a small SDK surface while using OpenID Connect Authorization Code + PKCE underneath. It redirects users to a branded NamoID sign-in page and returns a one-time authorization code to the application. The Client ID resolves the application, environment, issuer, and Hosted Auth domain—there is no application ID or issuer to copy into SDK configuration.

Example Use it when
hosted-auth/react-spa You want a popup-first React sign-in modal with a secure redirect fallback and Authorization Code + PKCE without a secret.
hosted-auth/express-react React and a separate Express API need a confidential, server-managed application session.
hosted-auth/nextjs You want the smallest complete Next.js App Router integration.
hosted-auth/nextjs-supabase NamoID owns authentication and Supabase stores application data.

The Express and Next.js examples demonstrate the complete confidential Hosted Auth flow:

  1. Start a state-bound sign-in transaction.
  2. Redirect the browser to the application’s NamoID-hosted sign-in page.
  3. Exchange the returned one-time code at the discovered token endpoint.
  4. Validate the signed ID token and load the subject from UserInfo.
  5. Create an HttpOnly application session and refresh it server-side.
  6. Revoke the token grant and use standard provider logout during sign-out.

The React SPA demonstrates the public-client variant: an application-owned modal launches NamoID Hosted Auth in a focused popup, a same-origin callback bridge returns the authorization result, and a fresh full-page redirect is used when popups are blocked. State and PKCE protect both presentations, the Client ID is safe to expose, and no Client Secret is placed in frontend code.

Run with Docker

Each example has a production multi-stage Docker image. Copy the root .env.example to .env, fill in the values for the service you want, then run:

# Express + React
docker compose up --build express-react

# React SPA
docker compose up --build react-spa

# Standalone Next.js
docker compose up --build nextjs

# Next.js with Supabase
docker compose up --build nextjs-supabase

# Or run every example
docker compose up --build

The Compose services load secrets only at runtime. Local environment files, dependencies, and build outputs are excluded from Docker build contexts. Change the matching *_HOST_PORT in .env when a default host port is already occupied, then update that example's application URL and registered NamoID callback.

Integration families

Family Purpose Repository status
Hosted Auth NamoID-hosted consumer sign-in and application sessions Available
OAuth / OpenID Connect Standards-based protocol used underneath Hosted Auth SDKs Available through Hosted Auth
Workforce SSO Employee application access through OIDC or SAML Add when public examples are ready
Agent Access Governed OAuth and MCP access for agents and tools Add when public examples are ready

Directories for planned families will be added only when their public contract is supported and tested. This prevents examples from advertising configuration that is not available in the Console.

Links

License

MIT © PolyMindsLabs Pvt. Ltd.

About

Runnable OAuth 2.1 + OIDC integration examples for NamoID across 11 stacks — Next.js, Express, FastAPI, Flask, Go, Spring Boot, .NET, Rust, Ruby, PHP, and curl.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages