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

@nube-auth/react

v0.1.2

Published

React hooks and components for Nube Auth authentication and user management

Downloads

295

Readme

@nube-auth/react

React hooks and components for Nube Auth authentication and user management.

Installation

pnpm add @nube-auth/react

Setup

Wrap your app with NubeAuthProvider:

import { NubeAuthProvider } from '@nube-auth/react';

function App() {
  return (
    <NubeAuthProvider
      config={{
        gatewayUrl: 'https://api.nubeauth.com'
      }}
    >
      <YourApp />
    </NubeAuthProvider>
  );
}

Hooks

useAuth

Check authentication status and logout:

import { useAuth } from '@nube-auth/react';

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

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      {isAuthenticated ? (
        <>
          <span>Hello, {user?.name}</span>
          <button onClick={() => logout()}>Logout</button>
        </>
      ) : (
        <a href="/login">Login</a>
      )}
    </div>
  );
}

useMe

Get and update current user profile:

import { useMe } from '@nube-auth/react';

function Profile() {
  const { user, isLoading, update, isUpdating } = useMe();

  if (isLoading) return <div>Loading...</div>;

  const handleUpdate = () => {
    update({ name: 'New Name' });
  };

  return (
    <div>
      <h1>{user?.name}</h1>
      <p>{user?.primary_email}</p>
      <button onClick={handleUpdate} disabled={isUpdating}>
        Update Name
      </button>
    </div>
  );
}

useSessions

Manage user sessions:

import { useSessions } from '@nube-auth/react';

function Sessions() {
  const { sessions, isLoading, deleteSession, deleteAll } = useSessions();

  if (isLoading) return <div>Loading...</div>;

  return (
    <div>
      <h2>Active Sessions</h2>
      <button onClick={() => deleteAll()}>Revoke All Sessions</button>
      {sessions.map((session) => (
        <div key={session.public_id}>
          <p>Created: {new Date(session.created_at * 1000).toLocaleDateString()}</p>
          <button onClick={() => deleteSession(session.public_id)}>
            Revoke
          </button>
        </div>
      ))}
    </div>
  );
}

Custom Query Client

If you want to provide your own React Query client:

import { QueryClient } from '@tanstack/react-query';
import { NubeAuthProvider } from '@nube-auth/react';

const queryClient = new QueryClient({
  defaultOptions: {
    queries: {
      staleTime: 1000 * 60 * 10, // 10 minutes
    },
  },
});

function App() {
  return (
    <NubeAuthProvider
      config={{ gatewayUrl: 'https://api.nubeauth.com' }}
      queryClient={queryClient}
    >
      <YourApp />
    </NubeAuthProvider>
  );
}

Backend Usage

For backend/SSR usage with S2S token:

import { NubeAuthProvider } from '@nube-auth/react';

function App() {
  return (
    <NubeAuthProvider
      config={{
        gatewayUrl: process.env.GATEWAY_URL,
        s2sToken: process.env.X_NUBE_AUTH_SERVICE_TOKEN
      }}
    >
      <YourApp />
    </NubeAuthProvider>
  );
}

Brand Logos

Centralized brand logo components for consistent branding across all dashboards:

import {
  GoogleLogo,
  GitHubLogo,
  StripeLogo,
  NextJsLogo,
  ReactLogo,
  JavaScriptLogo,
  FlutterLogo,
  NodeJsLogo,
  TailwindLogo,
} from '@nube-auth/react';

function LoginButtons() {
  return (
    <div className="flex gap-4">
      <button className="flex items-center gap-2">
        <GoogleLogo className="w-5 h-5" />
        Sign in with Google
      </button>
      <button className="flex items-center gap-2">
        <GitHubLogo className="w-5 h-5" />
        Sign in with GitHub
      </button>
    </div>
  );
}

function PaymentProviders() {
  return (
    <div>
      <div className="flex items-center gap-2">
        <StripeLogo className="w-6 h-6" />
        <span>Stripe</span>
      </div>
    </div>
  );
}

function IntegrationShowcase() {
  return (
    <div className="grid grid-cols-3 gap-4">
      <div className="flex items-center gap-2">
        <NextJsLogo className="w-8 h-8" />
        <span>Next.js</span>
      </div>
      <div className="flex items-center gap-2">
        <ReactLogo className="w-8 h-8" />
        <span>React</span>
      </div>
      <div className="flex items-center gap-2">
        <FlutterLogo className="w-8 h-8" />
        <span>Flutter</span>
      </div>
    </div>
  );
}

Available Logos

  • OAuth Providers: GoogleLogo, GitHubLogo
  • Payment Providers: StripeLogo
  • Framework SDKs: NextJsLogo, ReactLogo, JavaScriptLogo, FlutterLogo, NodeJsLogo, TailwindLogo

All logo components accept a className prop for sizing and styling.