New:Socket for Asana Is Now Available.Learn more
Get Started

infinityauth

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

infinityauth

unpublished
npmnpm
Version
1.0.1
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

InfinityAuth JS Client

Author: ashutosh0x

A lightweight JavaScript client for the InfinityAuth API. It supports signup, login, refresh token rotation, logout, and fetching the current user profile.

Installation

npm install infinityauth

After install, you'll see a notice: "package author: ashutosh0x".

Quick Start

import { createAuthClient } from 'infinityauth';

const auth = createAuthClient({
  baseURL: 'http://localhost:4000',
  clientId: 'your-client-id',
});

// Signup
await auth.signup('user@example.com', 'StrongP@ssw0rd!');

// Login
const { accessToken, refreshToken } = await auth.login('user@example.com', 'StrongP@ssw0rd!');

// Current user
const me = await auth.getUser();

// Refresh
const newTokens = await auth.refreshToken();

// Logout
await auth.logout();

Role helper

const isAdmin = (auth).hasRole?.('admin');

Offline-first profile

// If offline, getUser will return last cached profile
const me = await auth.getUser();

API

  • createAuthClient(config) returns an AuthClient
    • config.baseURL: string (required) – Base URL of InfinityAuth API
    • config.clientId: string (required)
    • config.clientSecret: string (optional)
    • config.storage: 'memory' | 'localStorage' (optional)

AuthClient methods

  • signup(email, password){ accessToken, refreshToken, expiresIn }
  • login(email, password){ accessToken, refreshToken, expiresIn }
  • getUser(){ id, email, role } | null
  • refreshToken(){ accessToken, refreshToken, expiresIn }
  • logout()void

Notes

  • Client stores tokens in memory by default. For browser persistence, pass storage: 'localStorage'.
  • Ensure your server is configured for CORS and uses RS256 JWTs with a JWKS endpoint.
  • Never commit private keys; use environment variables in production.

License

MIT © ashutosh0x

FAQs

Package last updated on 14 Aug 2025

Related posts