Registry / security / vishwajeet-auth-lib

vishwajeet-auth-lib

JSON →
library1.0.0-SNAPSHOT-54jsnpmunverified

@leapfinance/auth-kit v1.0.0-SNAPSHOT-54 is an authentication library for React applications that provides token generation and login modal management. It features phone-based OTP login with optional Truecaller integration, event subscription, and logout capabilities. Stable release cadence is irregular as it is a snapshot version. Differentiators include minimal setup with a single component and imperative API for controlling login flow. Ships TypeScript types.

npm install vishwajeet-auth-lib
INSTALL
IMPORT
SIG · VISHWAJEET-AUTH-LI
V
vishwajeet-auth-lib
securityjavascriptv1.0.0-SNAPSHOT-54
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

WithLogin
import { WithLogin } from '@leapfinance/auth-kit'
const WithLogin = require('@leapfinance/auth-kit')
ESM-only package; named export, not default. TypeScript types included.
leapLogin
import { leapLogin } from '@leapfinance/auth-kit'
import leapLogin from '@leapfinance/auth-kit'
leapLogin is a named export, not default. Use named import.
LoginOptionDto
import type { LoginOptionDto } from '@leapfinance/auth-kit'
import { LoginOptionDto } from '@leapfinance/auth-kit'
Type-only import to avoid runtime inclusion.

Setup WithLogin provider globally and trigger login modal with leapLogin() to get token via callback.

import { WithLogin, leapLogin } from '@leapfinance/auth-kit'; import { useState } from 'react'; const appName = 'MyApp'; const apiPath = 'https://api.example.com/auth'; const logo = 'https://example.com/logo.png'; function App() { const [token, setToken] = useState<string | null>(null); const handleLogin = () => { leapLogin({ title: 'Sign In', canClose: true, phone: '+1234567890', callback: (token) => { setToken(token); console.log('Login success', token); }, canChangeCountryCode: true, logo: 'https://example.com/modal-logo.png', enableTrueCaller: true, }); }; return ( <div> <WithLogin appName={appName} apiPath={apiPath} logo={logo} /> <button onClick={handleLogin}>Log In</button> {token && <p>Token: {token}</p>} </div> ); }
Debug
Known issues
gotchaleapLogin.isLogin() may return incorrect value if cookies are not managed by the library.
fix
Ensure cookies are enabled and not blocked by browser settings.
affects: >=1.0.0
breakingleapLogin.error() and leapLogin.loader() have identical documentation; loader function may not work as expected.
fix
Use leapLogin.loader() correctly; if not working, check if it expects a boolean or string parameter.
affects: >=1.0.0
deprecatedleapLogin.logout() may be deprecated in future versions in favor of a more explicit method.
fix
Monitor changelog; consider using event-based logout if available.
affects: 1.0.0-SNAPSHOT
Errors
Common errors & fixes
Cannot find module '@leapfinance/auth-kit'
Package not installed or typo in package name.
fix
Run 'yarn add @leapfinance/auth-kit' and ensure package.json includes it.
'leapLogin' is not defined
Imported as default instead of named export.
fix
Use 'import { leapLogin } from '@leapfinance/auth-kit'
TypeError: leapLogin.isLogin is not a function
leapLogin not initialized or imported incorrectly.
fix
Ensure WithLogin component is rendered and leapLogin is imported correctly.
Upgrade
Version history
1.0.0-SNAPSHOT-54latest on npm
Audit
Dependencies
reactrequiredPeer dependency required for React components
react-domrequiredPeer dependency required for React DOM rendering
Agent activity
22 hits · last 30 days
node
20
Resources
vishwajeet-auth-lib — npm install vishwajeet-auth-lib · libregistry