@reactor-cloud/auth
v0.3.0
Published
Authentication client for Reactor JS SDK
Maintainers
Readme
@reactor-cloud/auth
Authentication client for Reactor. Handles user signup, signin, session management, and organization membership.
Installation
npm install @reactor-cloud/auth @reactor-cloud/sharedOr use the unified client:
npm install @reactor-cloud/clientQuick Start
import { AuthClient } from '@reactor-cloud/auth';
const auth = new AuthClient(ctx, {
persistSession: true,
autoRefresh: true,
});
// Sign up
const { data, error } = await auth.signUp({
email: '[email protected]',
password: 'securepassword',
});
// Sign in
const { data } = await auth.signIn({
email: '[email protected]',
password: 'password',
});
// Get current user
const user = await auth.getUser();
// Sign out
await auth.signOut();Features
- Session Management - Automatic token refresh and persistence
- Multi-tab Sync - Session changes sync across browser tabs
- Organization Support - Create and manage organizations
- Permissions - Check user permissions
- API Keys - Create and manage API keys
- Password Reset - Request and confirm password resets
- Email Verification - Verify user email addresses
API Reference
Authentication
signUp(params)- Create a new user accountsignIn(params)- Sign in with email/passwordsignOut()- Sign out and revoke sessiongetSession()- Get current sessiongetUser()- Get current userupdateUser(params)- Update user profiledeleteUser()- Delete user account
Password Reset
requestPasswordReset({ email })- Request a reset emailconfirmPasswordReset({ token, newPassword })- Set new password
Email Verification
verifyEmail({ token })- Verify email with tokenresendVerification({ email })- Resend verification email
Organizations
auth.orgs.create(params)- Create organizationauth.orgs.list()- List user's organizationsauth.orgs.get(id)- Get organizationauth.orgs.update(id, params)- Update organizationauth.orgs.delete(id)- Delete organization
Members
auth.orgs.members.list(orgId)- List membersauth.orgs.members.update(orgId, userId, params)- Update memberauth.orgs.members.remove(orgId, userId)- Remove member
API Keys
auth.apiKeys.list()- List API keysauth.apiKeys.create(params)- Create API keyauth.apiKeys.revoke(id)- Revoke API key
Documentation
License
MIT
