Registry / auth-security / supaapps-auth

supaapps-auth

JSON →
library3.2.2jsnpmunverified

Authentication library for SupaApps projects. Current version 3.2.2, providing token management, OAuth login flows (Google), and token validation. It uses a singleton pattern via AuthManager and supports ESM imports with TypeScript types included. Differentiators include simple API with login URI generation, access token decoding, and Bearer token validation. Release cadence is not specified but likely follows SupaApps updates.

npm install supaapps-auth
INSTALL
IMPORT
SIG · SUPAAPPS-AUTH
S
supaapps-auth
auth-securityjavascriptv3.2.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthManager
import { AuthManager } from 'supaapps-auth'
import AuthManager from 'supaapps-auth'
Named export, not default. Also avoid CommonJS require as package is ESM-only.
AuthManager (type)
import type { AuthManager } from 'supaapps-auth'
TypeScript type import for type-only usage.
AuthManager (namespace)
import { AuthManager as AM } from 'supaapps-auth'
Optional renaming to avoid conflicts.

Initializes AuthManager with API URL, tenant, redirect URI and redirect callback; checks login status, gets Google login URI, and logs out.

import { AuthManager } from 'supaapps-auth'; const authManager = new AuthManager( 'https://supaapps-auth-api.testing.sacl.io/', 'root', 'http://localhost:3001/exchange', () => { console.log('redirect to login'); } ); // Check if user must be logged in authManager.mustBeLoggedIn().then((isLoggedIn) => { if (isLoggedIn) { // Proceed } else { authManager.getLoginWithGoogleUri().then((uri) => { window.location.href = uri; }); } }); // Logout authManager.logout().then(() => { console.log('Logged out'); });
Debug
Known issues
gotchamustBeLoggedIn() may return false even if token is valid if token is not in local storage
fix
Ensure token is stored via setAccessToken() or login flow.
affects: >=3.0
gotchanew AuthManager() constructs a new instance, but getInstance() returns a singleton. Mixing patterns may cause multiple API calls.
fix
Use AuthManager.getInstance() after initial construction, or consistently use constructor without getInstance.
affects: >=3.0
deprecatedvalidateToken() may be deprecated in future versions; check docs
fix
Use AuthManager.validateToken() as shown, but monitor for replacement.
affects: >=3.2
gotchagetLoginWithGoogleUri() returns a URI, but does not automatically redirect; developer must handle navigation.
fix
Assign window.location.href to the URI, or use an anchor tag.
affects: >=3.0
Errors
Common errors & fixes
Cannot find module 'supaapps-auth' or its corresponding type declarations.
Package not installed or TypeScript unable to resolve types (though types are shipped).
fix
Run npm install supaapps-auth and ensure tsconfig.json includes 'node_modules/@types' or the package's types.
TypeError: supaapps_auth_1.AuthManager is not a constructor
Using default import instead of named import.
fix
Use import { AuthManager } from 'supaapps-auth' instead of import AuthManager from 'supaapps-auth'.
Error: authManager.mustBeLoggedIn is not a function
Calling mustBeLoggedIn on undefined or wrong object (e.g., using getInstance() before constructor).
fix
Ensure AuthManager is instantiated or getInstance() is called after construction.
Upgrade
Version history
3.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
12
OpenAI (training)
1
Resources
supaapps-auth — npm install supaapps-auth · libregistry