
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@lendi/auth
Advanced tools
A reusable authentication package that handles OTP (One-Time Password) functionality using Auth0 and Twilio
A reusable authentication package that handles OTP (One-Time Password) functionality using Auth0 and Twilio.
yarn add @lendi/auth
import { AuthService } from '@lendi/auth';
// 1. Initialize the service with your brand, type, and environment
const auth = new AuthService({
brand: 'Aussie',
type: 'Customer',
environment: 'Development',
// Optionally override:
// audience, scope, redirectUri, retry, debug
});
// 2. Send authentication code
await auth.sendCode({ phoneNumber: '+61412345678' });
// 3. Verify code (with optional user data)
const result = await auth.verifyCode({
phone: '+61412345678',
code: '123456',
email: 'john@example.com', // Optional
firstName: 'John', // Optional
leadId: 'lead-123' // Optional
});
if (result.valid) {
console.log('Authentication successful!');
console.log('Token:', result.token);
}
// 4. Check authentication status and token
const status = auth.getStatus();
const token = auth.getToken();
// 5. Logout
auth.logout();
clientID
, domain
, audience
, and redirectUri
will be set automatically based on your brand, type, and environment.Auth0 configuration (clientID, domain, audience, callback URL) is automatically mapped based on the brand
, type
, and environment
you provide. You do not need to manually specify these values unless you want to override them for a specific use case.
sendCode({ phoneNumber })
verifyCode({ phone, code, email?, leadId?, firstName? })
getToken()
getStatus()
logout()
getSessionState()
getSessionState()
Returns an object with the current session state, including:
{
brand: Brand;
type: Type;
environment: Environment;
status: AuthStatus;
error?: AuthError;
expiry?: number;
token?: string;
identity?: {
id: string;
existingUser?: boolean;
authId?: string;
};
}
lendi_auth
(session state) and lendi_me
(user info) keys in sessionStorage.ownerId
or storeId
.lendi_me
) includes { firstName, phone, email, version }
.LENDI
FAQs
A reusable authentication package that handles OTP (One-Time Password) functionality using Auth0 and Twilio
We found that @lendi/auth demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 77 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.