Skip to main content

API Reference

node-auth is a 360-degree communication and access control layer that exposes its functionality through three core routers. You can mount any combination of these routers depending on your application's needs.

1. Auth Router (Default: /auth)​

Handles all user-facing authentication flows (login, registration, password resets, 2FA, OAuth, etc).

2. Tools Router (Default: /tools)​

Handles machine-to-machine communication, telemetry, Server-Sent Events (SSE), and inbound/outgoing dynamic webhooks. See Tools Router Endpoints for the full list.

3. Admin Router (Default: /admin/api)​

Provides a secure REST API (and a built-in UI) for administrative tasks like user management, role assignments, UI webhooks, settings, and session revocation. See Admin REST API for the full list.


Auth Router Endpoints Overview​

MethodPathDescriptionAuth Required
POST/auth/loginEmail/password login❌
POST/auth/registerRegister new user (requires onRegister)❌
POST/auth/logoutLog out✅
POST/auth/refreshRefresh tokens❌ (refresh token)
GET/auth/meGet current user profile✅
POST/auth/forgot-passwordRequest password reset❌
POST/auth/reset-passwordReset with token❌
POST/auth/change-passwordChange password✅
POST/auth/send-verification-emailSend email verification✅
GET/auth/verify-emailVerify email token❌
POST/auth/change-email/requestRequest email change✅
POST/auth/change-email/confirmConfirm email change❌
POST/auth/magic-link/sendSend magic link❌
POST/auth/magic-link/verifyVerify magic link❌
POST/auth/sms/sendSend SMS OTP❌
POST/auth/sms/verifyVerify SMS OTP❌
POST/auth/2fa/setupGet TOTP secret + QR code✅
POST/auth/2fa/verify-setupActivate TOTP✅
POST/auth/2fa/verifyComplete 2FA login❌ (temp token)
POST/auth/2fa/disableDisable 2FA✅
GET/auth/oauth/:providerOAuth redirect❌
GET/auth/oauth/:provider/callbackOAuth callback❌
POST/auth/sessions/cleanupDelete expired sessions❌
GET/auth/linked-accountsList linked OAuth accounts✅
DELETE/auth/linked-accounts/:provider/:idUnlink OAuth account✅
POST/auth/link-requestLink new email address✅
POST/auth/link-verifyConfirm account link❌
DELETE/auth/accountDelete account✅

See Endpoints for full request/response documentation.