accounts-base package implements Meteor’s foundational user account system, providing the core infrastructure for authentication and user management.
Installation
Overview
The accounts-base package provides:- User authentication and session management
- Login/logout functionality
- User collection management (
Meteor.users) - Hooks for login/logout events
- Integration with DDP for client-server communication
- Support for multiple login service packages
accounts-base is the foundation package that other authentication packages (like
accounts-password, accounts-google, accounts-facebook) build upon.Package Information
- Version: 3.2.0
- Summary: A user account system
- Main exports:
Accounts - Client module:
client_main.js - Server module:
server_main.js
Core API
Accounts Object
The globalAccounts object provides all account-related functionality.
Configuration
Automatically send verification emails to new users
Prevent account creation from the client
Number of days until login tokens expire
Days until password reset tokens expire (default: 3)
Return generic error messages to prevent user enumeration
User Management
Meteor.users Collection
TheMeteor.users collection stores all user accounts:
Client-Side Methods
Current User
These methods are reactive and will trigger re-runs when the login state changes.
Login State
Server-Side Methods
Login Handlers
Validation Hooks
Lifecycle Hooks
onLogin / onLogout
URL Generators (Server)
Dependencies
The accounts-base package uses:ecmascript- ES2015+ supportddp- Client-server communicationddp-rate-limiter- Rate limiting for securitymongo- User collection storagetracker- Reactive updates (client)reactive-var- Reactive variables (client)localstorage- Token persistence (client)check- Input validation (server)random- Token generationcallback-hook- Lifecycle hooks
Related Packages
accounts-password
Password-based authentication
accounts-oauth
OAuth integration base
accounts-ui
Drop-in login UI components
accounts-2fa
Two-factor authentication