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

@acl-identity/react

v0.1.6

Published

React hooks and provider for ACL Identity — Phase 2

Readme

@acl-identity/react

React integration for the ACL Identity SDK. Provides AuthProvider, the useAuth hook, and ready-made components for sign-in, sign-out, and OAuth2 callback handling.

Installation

npm install @acl-identity/react
# or
pnpm add @acl-identity/react

Requires React 18 or later as a peer dependency.

Quick start

1. Create the client and wrap your app

import { ACLBrowserClient, AuthProvider } from '@acl-identity/react';

const client = new ACLBrowserClient({
  baseUrl: 'https://auth.example.com',
  clientId: 'my-client-id',
  redirectUri: 'https://app.example.com/callback',
  orgSlug: 'my-org',
});

function App() {
  return (
    <AuthProvider
      client={client}
      clientId="my-client-id"
      redirectUri="https://app.example.com/callback"
      orgSlug="my-org"
      onRedirectCallback={(appState) => {
        // navigate to appState?.returnTo after login
      }}
    >
      <YourApp />
    </AuthProvider>
  );
}

2. Use the useAuth hook

import { useAuth } from '@acl-identity/react';

function Header() {
  const { user, isAuthenticated, isLoading, signIn, signOut } = useAuth();

  if (isLoading) return <Spinner />;

  if (!isAuthenticated) {
    return <button onClick={() => signIn()}>Sign in</button>;
  }

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

3. Handle the OAuth2 callback

Add a callback page that renders <CallbackHandler />:

import { CallbackHandler } from '@acl-identity/react';
import { useNavigate } from 'react-router-dom';

export function CallbackPage() {
  const navigate = useNavigate();
  return (
    <CallbackHandler
      onSuccess={() => navigate('/')}
      onError={(err) => console.error(err)}
    />
  );
}

Components

| Component | Description | |---|---| | AuthProvider | Context provider — wraps your app | | CallbackHandler | Processes the OAuth2 redirect callback | | SignInButton | Pre-wired sign-in button | | SignOutButton | Pre-wired sign-out button | | SilentCallbackPage | Placed at silentRedirectUri for iframe-based silent renewal |

Silent token renewal

Mount <SilentCallbackPage /> at a dedicated route (e.g. /silent-callback) and pass its URL to AuthProvider:

<AuthProvider
  ...
  silentRedirectUri="https://app.example.com/silent-callback"
>

Tokens are renewed automatically before they expire without a visible redirect.

useAuth return value

| Field | Type | Description | |---|---|---| | user | UserClaims \| null | Decoded JWT claims of the current user | | isAuthenticated | boolean | Whether a valid token exists | | isLoading | boolean | True while the initial session check is in progress | | error | Error \| null | Last auth error | | signIn(options?) | Promise<void> | Redirects to the authorization server | | signOut(options?) | Promise<void> | Clears tokens and optionally revokes them | | getAccessToken() | Promise<string \| null> | Returns the current access token | | handleCallback(url?) | Promise<{ appState? }> | Manually processes a callback URL |

License

MIT