orgbyte-auth-react
v0.2.3
Published
React SDK for Authlab API-first authentication
Readme
orgbyte-auth-react
React SDK for Orgbyte Auth (API-first authentication). Built on orgbyte-auth-js.
Install
npm install orgbyte-auth-react orgbyte-auth-jsUsage
Wrap your app with AuthlabProvider, then use hooks and components:
import { AuthlabProvider, useAuthLab, UserProfile } from "orgbyte-auth-react";
// In your root layout
<AuthlabProvider apiKey="pk_xxx" baseUrl="https://..." redirectUri="https://yourapp.com/auth/callback">
<App />
</AuthlabProvider>
// Login / register (redirect)
const { login, register, user, isAuthenticated, logout, refreshProfile } = useAuthLab();
// Profile as page or modal (Clerk-style)
<UserProfile variant="page" fetchUserUrl="/api/protected" onLogout={() => router.push("/")} />
<UserProfile variant="modal" trigger={<button>Account</button>} fetchUserUrl="/api/protected" />License
MIT
