MagicAuth

📚 MagicAuth API Documentation

🔐 What is MagicAuth?

MagicAuth is a passwordless authentication API that allows users to log in via magic links sent to their email. It's fast, secure, and removes the hassle of managing passwords.

🚀 Getting Started

To send a login magic link:

POST /api/auth/send-link
Content-Type: application/json
Body:
{
  "email": "user@example.com"
}

✅ Verifying the Token

POST /api/auth/verify
Body:
{
  "email": "user@example.com",
  "token": "12345"
}

You'll receive a JWT token. Store it in localStorage or cookie to manage sessions.

⚙️ Advanced Options

  • Custom SMTP setup per user
  • Use your own MongoDB for login data
  • Token expiry default is 10 minutes
  • JWT expiry default is 1 hour (configurable)
  • Simple integration in any frontend (React, Vue, etc.)

🛠 Example Frontend Call

const res = await fetch("/api/auth/send-link", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email }),
});

© 2025 MagicAuth – Simplifying secure login 🔒