Skip to content

Example Todos App

The demo app is a practical reference for integrating a browser application with DarkAuth. It is intentionally small enough to understand, but it still shows the pieces a real app needs: login, callback handling, authenticated routing, session refresh, and protected data loading.

  • Redirecting to DarkAuth for login.
  • Handling the OAuth callback.
  • Reading the authenticated session.
  • Protecting app routes.
  • Showing user-facing denial or error states.
  • Calling an app backend with authenticated context.
  • Organizing authenticated UI around a sidebar and dashboard.

Start DarkAuth, then run the demo app and its server from the monorepo:

Terminal window
npm run demo:dev

Use the default demo public client or register a new one with callback URLs that match your local ports.

Copy the flow shape, not the product UI. A real app should have its own data model, authorization checks, error handling, and recovery story. The useful parts are how callback state is handled, how authenticated routes are guarded, and how the app reacts when the user is not signed in.

Before using the same pattern in production, add backend token validation, clear permission checks, production redirect URIs, logging, logout behavior, and a decision about whether your app needs ZK DRK delivery.