@cellarnode/auth
v0.7.1
Published
Shared OTP-based authentication — token store, API client, React UI components for CellarNode dashboards.
Downloads
1,222
Readme
@cellarnode/auth
Shared OTP-based authentication for CellarNode dashboards — token store, API client, React UI components.
Install
npm install @cellarnode/authUsage
Core (framework-agnostic)
import { createAuthStore, createAuthClient, createAuthApi } from "@cellarnode/auth";
const authStore = createAuthStore({
baseUrl: "http://localhost:4000",
});
const authClient = createAuthClient({
baseUrl: "http://localhost:4000",
store: authStore,
onAuthFailure: () => window.location.assign("/login"),
});
const authApi = createAuthApi({ client: authClient, store: authStore });React Components
import { LoginForm, RegisterForm, UnauthorizedPage } from "@cellarnode/auth/react";Tailwind CSS Content Scan
Add this to your CSS file so Tailwind picks up utility classes from the package:
@source "../node_modules/@cellarnode/auth/dist/**/*.js";Exports
@cellarnode/auth— Core:createAuthStore,createAuthClient,createAuthApi,validateUserType, types@cellarnode/auth/react— React:LoginForm,RegisterForm,UnauthorizedPage,SquircleShift
License
MIT
