npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@atzentis/auth-react

v0.1.0

Published

Atzentis Auth React — hooks and components for auth.atzentis.com

Readme

@atzentis/auth-react

npm version License: MIT TypeScript

React hooks and components for auth.atzentis.com. Built on top of @atzentis/auth-sdk with full TanStack Query integration, 40+ pre-built components, and localization support.

Features

  • AuthProvider — wraps QueryClientProvider internally, supports SSR hydration via initialUser, and fires callbacks for session expiry, token refresh, and new device alerts
  • 14 mutation hooks — one hook per auth operation, all backed by TanStack Query mutations
  • 12 query hooks — reactive queries for user, session, devices, sessions, organizations, API keys, login activity, and more
  • 40+ components — complete auth flows, settings cards, organization management, and RBAC guards
  • Centralized localization — ~341 keys, fully replaceable per component via the localization prop
  • SSR support — separate server entry point (@atzentis/auth-react/server) with no "use client" banner

Installation

npm install @atzentis/auth-react @atzentis/auth-sdk @tanstack/react-query
# or
pnpm add @atzentis/auth-react @atzentis/auth-sdk @tanstack/react-query

Quick Start

Wrap your application with AuthProvider:

import { AuthProvider } from "@atzentis/auth-react";

function App() {
  return (
    <AuthProvider
      baseUrl="https://auth.atzentis.com"
      onSessionExpired={() => router.push("/login")}
      onTokenRefreshed={(session) => console.log("Refreshed", session.id)}
      onNewDeviceAlert={(alert) => console.warn("New device", alert)}
    >
      <YourApp />
    </AuthProvider>
  );
}

Use hooks in your components:

import { useAuth, useSession, useUser } from "@atzentis/auth-react";

function Dashboard() {
  const { signInWithEmail, signOut, isAuthenticated } = useAuth();
  const { data: session, isLoading } = useSession();
  const { data: user } = useUser();

  if (isLoading) return <Spinner />;

  if (!isAuthenticated) {
    return (
      <button onClick={() => signInWithEmail({ email, password })}>
        Sign in
      </button>
    );
  }

  return (
    <div>
      <p>Welcome, {user?.name}</p>
      <button onClick={signOut}>Sign out</button>
    </div>
  );
}

Hooks

Auth and Session

| Hook | Purpose | | --- | --- | | useAuth() | Facade over all auth mutations. Provides signInWithEmail, signInWithUsername, signInWithOAuth, signInWithPhone, signInWithMagicLink, signUp, signOut, requestPasswordReset, resetPassword, sendVerificationEmail, verifyEmail, and more (22 methods total) | | useSession() | Read-only access to the current session | | useSessions() | List and manage all sessions; deviceSessions and refresh() | | useAuthenticate() | Programmatic navigation helper for auth redirects |

User and Profile

| Hook | Purpose | | --- | --- | | useUser() | Fetch and update the current user profile (12 methods) | | usePhone() | Send OTP, verify phone number, phone sign-in | | usePasskeys() | Register, authenticate, list, rename, and remove passkeys |

Devices and Activity

| Hook | Purpose | | --- | --- | | useDevices() | List devices, trust/untrust, remove; refresh() required to load | | useLoginActivity() | Paginated login event history with filtering; refresh() required |

Organizations and API Keys

| Hook | Purpose | | --- | --- | | useOrganizations() | 14 methods — full organization CRUD, member and invitation management | | useApiKeys() | 8 methods — create, rotate, revoke, validate, and track usage |

Utility

| Hook | Purpose | | --- | --- | | useAuthClient() | Direct access to the underlying AuthClient instance | | useAuthLocalization() | Access the active localization strings |

Components

Auth Forms

| Component | Description | | --- | --- | | LoginForm | Email/password login with optional OAuth buttons | | SignupForm | New account creation | | PhoneLoginForm | Two-step phone + OTP login | | MagicLinkForm | Passwordless magic link request | | OAuthButton | Single OAuth provider button (google, apple, github) |

Auth Flows

| Component | Description | | --- | --- | | ForgotPasswordForm | Email input to request a password reset | | ResetPasswordForm | Token-based new password form | | EmailVerificationForm | Verify email with a code or link | | EmailOTPForm | OTP code entry for email-based auth | | TwoFactorForm | TOTP code entry with backup code fallback | | RecoverAccountForm | 4-step account recovery wizard | | AuthView | Route-based renderer — maps pathname strings to the correct form |

Settings Cards

| Component | Description | | --- | --- | | ChangePasswordCard | Update account password | | ChangeEmailCard | Update email address | | UpdateNameCard | Update display name | | UpdateUsernameCard | Update username with debounced availability check | | UpdateAvatarCard | Upload and preview a profile avatar | | SessionsCard | View and revoke active sessions | | ProvidersCard | Connect and disconnect OAuth providers | | TwoFactorCard | Enable/disable two-factor authentication | | PasskeysCard | Manage WebAuthn passkeys | | ApiKeysCard | Create, view, rotate, and revoke API keys | | DeleteAccountCard | Three-step account deletion confirmation | | AccountView | Orchestrator — renders all settings sections in one view |

Organization Components

| Component | Description | | --- | --- | | CreateOrganizationCard | Create a new org with auto-generated slug | | InviteMemberCard | Invite a user by email with role selection | | OrganizationMembersCard | List members, edit roles, remove members | | OrganizationInvitationsCard | View, resend (with cooldown), and revoke pending invitations | | AcceptInvitationCard | Accept or decline an incoming invitation | | OrganizationsCard | Grid/list view of all orgs with leave action | | OrganizationSwitcher | Dropdown to switch the active organization | | OrganizationSettingsView | Orchestrator — renders all org settings sections |

Control and Guard Components

| Component | Description | | --- | --- | | SignedIn | Renders children only when a session exists | | SignedOut | Renders children only when no session exists | | AuthLoading | Renders children while the session is loading | | Protect | RBAC wrapper — accepts role, permission, condition, and fallback props | | RedirectToSignIn | Redirects unauthenticated users to the sign-in page | | RedirectToSignUp | Redirects unauthenticated users to the sign-up page | | UserAvatar | Renders a user avatar image with initials fallback and online status | | SignInButton | Button that triggers sign-in navigation | | SignUpButton | Button that triggers sign-up navigation | | SignOutButton | Button that calls signOut() |

Localization

All components read from a centralized AuthLocalization object (~341 keys). Override any key globally via AuthProvider or per-component via the localization prop:

// Global override on AuthProvider
<AuthProvider
  baseUrl="https://auth.atzentis.com"
  localization={{
    loginForm: {
      title: "Welcome back",
      submitButton: "Continue",
    },
  }}
>

// Per-component override
<LoginForm
  localization={{
    title: "Sign in to Acme",
  }}
/>

Error messages from AuthErrorCode values are automatically localized via getLocalizedError(). Set localizeErrors={false} on AuthProvider to disable this behavior.

Server Entry Point

The default entry point (@atzentis/auth-react) adds a "use client" directive to all exports for React Server Component compatibility. For server-side usage (e.g., reading accountViewSections or organizationViewSections in a layout), import from the server entry:

import {
  accountViewSections,
  organizationViewSections,
} from "@atzentis/auth-react/server";

Peer Dependencies

| Package | Version | | --- | --- | | react | >= 18.0.0 | | react-dom | >= 18.0.0 | | @tanstack/react-query | ^5.0.0 | | @atzentis/ui-shadcn | >= 0.1.0 (optional) | | @atzentis/ui-shared | >= 0.1.0 (optional) |

The UI packages (@atzentis/ui-shadcn, @atzentis/ui-shared) are optional. If not installed, component rendering falls back to unstyled HTML elements.

Related Packages

License

MIT — see LICENSE for details.