@finlupid/auth
v0.2.0
Published
FinlupID Auth SDK — Firebase-like authentication for your projects
Maintainers
Readme
@finlupid/auth
Firebase-like authentication SDK for Finlup Cloud. Manage project members with email+password, OTP verification, and JWT tokens.
Installation
npm install @finlupid/auth
# or
pnpm add @finlupid/auth
# or
yarn add @finlupid/authQuick Start
import { FinlupID } from '@finlupid/auth';
const finlup = new FinlupID({
publicKey: 'fpk_your_project_public_key',
domain: window.location.origin,
});
// Login flow (2 steps)
const { otp_required } = await finlup.login('[email protected]', 'password123');
const session = await finlup.verifyOtp('[email protected]', '123456');
// Access tokens auto-refresh
const me = await finlup.getMe();
// Logout
await finlup.logout();API
new FinlupID(config)
config.publicKey(required) — Your project's public key from Finlup Cloud dashboardconfig.domain(optional) — Your app domain (validated against allowlist)config.apiUrl(optional) — API URL (defaults tohttps://cloud.finlup.id)
Auth Methods
| Method | Description |
|--------|-------------|
| login(email, password) | Step 1: send OTP to email |
| verifyOtp(email, code) | Step 2: verify OTP, get tokens |
| refreshToken() | Refresh access token |
| logout() | Revoke tokens |
| sendPasswordReset(email) | Send reset link |
| resetPassword(token, password) | Reset with token |
| getMe() | Get current user profile |
Events
const unsubscribe = finlup.onTokenRefresh((newToken) => {
console.log('Token refreshed:', newToken);
});
unsubscribe(); // remove listenerLicense
MIT
