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

@auth-strategy-manager/supabase

v2.0.1

Published

Supabase strategy for auth-strategy-manager

Readme

@auth-strategy-manager/supabase

Supabase strategy for auth-strategy-manager. v2 targets @auth-strategy-manager/core ^2.0.0.

Documentation in other languages

Installation

npm install @auth-strategy-manager/supabase @auth-strategy-manager/core @supabase/supabase-js

Usage

Use AuthStrategyManager from core for persistence (AuthStorageManager, strategy name, tokens). SupabaseStrategy uses the Supabase client and returns AuthManagerData from checkAuth, signIn, signUp, and refreshToken.

import { AuthStrategyManager } from '@auth-strategy-manager/core';
import { SupabaseStrategy } from '@auth-strategy-manager/supabase';
import { createClient } from '@supabase/supabase-js';

const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);

const supabaseStrategy = new SupabaseStrategy({
  supabase,
  name: 'supabase',
  signInUrl: 'https://myapp.com/login',
});

const authManager = new AuthStrategyManager([supabaseStrategy]);

const state = await authManager.checkAuth();
await authManager.signIn({ email: '[email protected]', password: 'password123' });
await authManager.signUp({ email: '[email protected]', password: 'password123', username: 'user' });
await authManager.refreshToken();
await authManager.signOut();

Before you test (integration checklist)

  • Install @auth-strategy-manager/core@^2.0.0 together with @auth-strategy-manager/supabase@^2.0.0 (peer dependency).
  • Prefer authManager.checkAuth() / signIn() / signUp() / refreshToken() / signOut() so AuthStorageManager stays in sync with AuthManagerData. Calling only supabaseStrategy.* skips manager persistence.
  • Strategy name and tokens are owned by core AuthStrategyManager / AuthStorageManager.
  • With multiple strategies, call authManager.use('supabase') (same string as name in config, default is 'supabase').

Breaking changes from v1

  • checkAuth returns Promise<AuthManagerData> (not boolean). Prefer authManager.checkAuth() so storage stays in sync.
  • refreshToken returns Promise<AuthManagerData> (not void).
  • signIn / signUp merge AuthManagerData into the returned object (Supabase payload plus isAuthenticated, strategyName, accessToken, refreshToken).
  • This package does not duplicate active-strategy or auth flags — use core for persistence.
  • Peer dependency: install @auth-strategy-manager/core ^2.0.0 yourself; it is no longer a direct dependency of this package.

Configuration

SupabaseConfig

type SupabaseConfig = {
  supabase: SupabaseClient;
  name?: string;
  /** URL for redirecting to the authorization page */
  signInUrl?: string;
};

Parameters

  • supabase — Supabase client instance
  • name — Strategy name (default: 'supabase')
  • signInUrl — URL for redirect after logout / custom flows

Token persistence is configured on core AuthStrategyManager via AuthStorageManager, not on this strategy.

API

SupabaseStrategy

Constructor

constructor(config: SupabaseConfig)

Methods

  • checkAuth(): Promise<AuthManagerData>
  • signIn<T, D>(config?: D): Promise<T> — expects { email, password }; return type merges AuthResponse with AuthManagerData
  • signUp<T, D>(config?: D): Promise<T> — expects { email, password, username }; same merge (session may be absent until email confirmation)
  • signOut(): Promise<void>
  • refreshToken<T>(args?: T): Promise<AuthManagerData>
  • clear(): void — clears in-memory token mirror on the strategy; prefer authManager.clear() for full storage sync
  • getCurrentUserId(): Promise<string | null>
  • getSessionInfo(): Promise<SessionInfo>

Properties

  • name, supabase, signInUrl
  • token (read-only) / isAuthenticated — mirror of the last known session from Supabase operations (can be stale if the Supabase session changes outside of this strategy; call authManager.checkAuth() / supabaseStrategy.checkAuth() to re-sync)
  • startUrl — get/set in-memory redirect base (for manager alignment)

License

ISC