Skip to content

๐Ÿ” react-auth โ€” Authentication UI and State

react-auth is the front-end half of the Aetos auth story: a JWT-backed AuthProvider, a pluggable login/register screen, profile screens, and an axios factory that carries bearer tokens and reacts to 401 responses. The server side lives in the Auth Server service; this package never defines an endpoint contract of its own.

Doc model: this wiki is written for humans โ€” guides and wiring recipes. The authoritative API contracts live in the code (RDFC JSDoc) and the machine-readable bundle under docs/mcp/. Browse the TypeDoc site for the full symbol reference.


๐Ÿš€ Key Features

  • โš›๏ธ AuthProvider + useAuth โ€” current user, token, loading and error state with login / register / logout
  • ๐Ÿงพ createApiClient โ€” axios with Authorization: Bearer <token> on every request and auth:unauthorized dispatch on 401
  • ๐ŸŽญ AuthPage โ€” a ready-made split-screen login/register form
  • ๐Ÿ‘ค ProfileCreate / ProfileEdit / ProfileView โ€” presentational profile screens that delegate persistence to your callbacks
  • ๐Ÿ—ƒ๏ธ tokenStore โ€” the single localStorage accessor keeping the UI and the network layer in sync

๐Ÿ“ฆ Documentation Structure

Section Description
Overview What the library is, and the token/session lifecycle
Wiring Guide Drop-in recipes for provider, gate and profile flows

๐Ÿš€ Quick Start

import { AuthProvider, useAuth, AuthPage } from "react-auth";

export default function Root() {
  return (
    <AuthProvider
      authConfig={{
        serverUrl: "https://api.example.com",
        loginPath: "/auth/login",
        registerPath: "/auth/register",
        logoutPath: "/auth/logout",
        mePath: "/auth/me",
        introspectPath: "/auth/introspect",
      }}
    >
      <LoginGate />
    </AuthProvider>
  );
}

  • Source Code: the react-auth repository
  • TypeDoc site: the generated lib HTML for the full API reference
  • MCP Bundle: docs/mcp/ (docs://modules/react-auth)
  • Library Registry: registered in the standards hub as react-auth (MCP :8011)
  • Auth Server: the service behind authConfig โ€” read docs://spec on the standards MCP for the pinned contract

ยฉ Aetoskia Internal โ€” react-auth 0.0.1