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

@proyecta-ai/auth

v0.1.5

Published

Authentication utilities for Proyecta applications using OIDC

Readme

@proyecta-ai/auth

OIDC authentication provider for Proyecta apps. Wraps react-oidc-context with Proyecta-specific configuration for the Proyecta auth server.

Installation

npm install @proyecta-ai/auth

Peer dependencies:

npm install react convex

Entry Points

The package has two entry points:

  • @proyecta-ai/auth/react -- Core auth provider, hooks, and re-exports from react-oidc-context
  • @proyecta-ai/auth/convex-react -- Convex integration (authenticated ConvexReactClient via Proyecta OIDC)

Usage

Basic Setup (@proyecta-ai/auth/react)

Wrap your app with ProyectaAuthProvider, passing your OIDC authority URL and client ID:

import { ProyectaAuthProvider } from '@proyecta-ai/auth/react';

function App() {
    return (
        <ProyectaAuthProvider
            authority={import.meta.env.VITE_PROYECTA_OIDC_AUTHORITY}
            client_id={import.meta.env.VITE_PROYECTA_OIDC_CLIENT_ID}
        >
            <MyApp />
        </ProyectaAuthProvider>
    );
}

You can pass additional OIDC settings via userManagerSettings:

<ProyectaAuthProvider
    authority={authority}
    client_id={clientId}
    userManagerSettings={{
        popup_redirect_uri: `${window.location.origin}/popup-callback.html`,
        scope: 'openid profile email',
        disablePKCE: !window.isSecureContext,
    }}
>
    {children}
</ProyectaAuthProvider>

Accessing the User

Use useUser for a simplified user object, or useAuth (re-exported from react-oidc-context) for full OIDC context:

import { useUser } from '@proyecta-ai/auth/react';

function Profile() {
    const { id, name, email, avatar, isAuthenticated, isLoading, error } = useUser();

    if (isLoading) return <div>Loading...</div>;
    if (!isAuthenticated) return <div>Not signed in</div>;

    return <div>Hello, {name}</div>;
}
import { useAuth } from '@proyecta-ai/auth/react';

function LoginButton() {
    const { isAuthenticated, signinPopup, removeUser } = useAuth();

    return isAuthenticated ? (
        <button onClick={() => removeUser()}>Sign out</button>
    ) : (
        <button onClick={() => signinPopup()}>Sign in</button>
    );
}

Handling Auth Callbacks (useAuthCallback)

For redirect-based auth flows, use useAuthCallback on your /auth/callback route:

import { useAuthCallback } from '@proyecta-ai/auth/react';

function AuthCallback() {
    const { status, error, retry } = useAuthCallback({
        isBackendAuthenticated: true, // or e.g. useConvexAuth().isAuthenticated
        onSync: () => updateUserInBackend(),
        onSuccess: () => navigate('/', { replace: true }),
        onNoAuthParams: () => navigate('/', { replace: true }),
    });

    if (status === 'error') {
        return <button onClick={retry}>Retry: {error}</button>;
    }

    return <div>Authenticating...</div>;
}

Convex Integration (@proyecta-ai/auth/convex-react)

ConvexProviderWithProyectaAuth wraps Convex's ConvexProviderWithAuth and passes the OIDC id_token to Convex. It must be placed inside ProyectaAuthProvider:

import { ProyectaAuthProvider } from '@proyecta-ai/auth/react';
import { ConvexProviderWithProyectaAuth } from '@proyecta-ai/auth/convex-react';
import { ConvexReactClient } from 'convex/react';

const convex = new ConvexReactClient(import.meta.env.VITE_CONVEX_URL);

function App() {
    return (
        <ProyectaAuthProvider
            authority={import.meta.env.VITE_PROYECTA_OIDC_AUTHORITY}
            client_id={import.meta.env.VITE_PROYECTA_OIDC_CLIENT_ID}
        >
            <ConvexProviderWithProyectaAuth client={convex}>
                <MyApp />
            </ConvexProviderWithProyectaAuth>
        </ProyectaAuthProvider>
    );
}

Exports

@proyecta-ai/auth/react

| Export | Type | Description | | ---------------------- | --------- | ----------------------------------------------------------------- | | ProyectaAuthProvider | Component | OIDC auth provider configured for Proyecta | | useUser | Hook | Simplified user object (id, name, email, avatar, isAuthenticated) | | useAuthCallback | Hook | Manages OAuth redirect callback lifecycle | | useAuth | Hook | Full OIDC context (re-export from react-oidc-context) | | hasAuthParams | Function | Checks if URL has OIDC callback params (re-export) | | AuthContextProps | Type | Type for the useAuth return value (re-export) |

@proyecta-ai/auth/convex-react

| Export | Type | Description | | -------------------------------- | --------- | -------------------------------------------------------- | | ConvexProviderWithProyectaAuth | Component | Authenticated Convex provider using Proyecta OIDC tokens |

Features

  • OIDC authorization code flow with PKCE
  • Google OAuth and email OTP support
  • Convex integration via @proyecta-ai/auth/convex-react
  • Configurable OIDC settings via userManagerSettings
  • Auth callback hook with timeout, retry, and backend sync support