Novel
Get NovelGuidesAPI Reference
Latest - 2025.1.0
Latest - 2025.1.0
  • Welcome to Novel
  • Start
  • Philosophy
  • Tech Stack
  • Releases
  • Versions
  • Changelog
  • License
  • Privacy
  • Warranty
  • Security Policy
  • Errors
    • Cannot start Novel
    • Unauthorized
    • Invalid Session
    • Validation Failed
  • Novel Server
    • Getting Started
    • Project Structure
    • With Novel Web
    • Configuration
    • Novel CLI
      • novel dev
      • novel start
      • novel new
    • Novel API
      • API Reference
    • Database
      • Caching
    • Migrations
    • Models
    • Routing
      • Route Directives
      • Middleware
      • Request Helpers
      • Schema
    • Sessions
    • Authentication
      • Passwords
      • Magic Links
      • Two-Factor Authentication
      • Forget Password
      • Email Verification
      • OAuth2 Support
    • Authorization
    • Users
    • Organizations
    • Subscriptions
    • Pricing
    • Validation
    • Mail
    • Notifications
    • API Keys
    • Events
    • Errors
    • Feature Flags
    • Uploading Files
    • Testing
    • Scheduled Cron Jobs
    • Background Jobs
    • Sockets
    • Logging
    • Telemetry
    • Deployment
  • Novel Web
    • Getting Started
    • Configuration
    • Project Structure
    • Routing
    • Layout and Styles
    • Authentication
    • Authorization
    • Requests
    • Request Files
    • Validation
    • Components
      • Button
      • Alerts
      • Copybox
      • Inline Notify
      • Input
      • Select
      • Toast
      • Toggle
      • Upload
      • Stripe Card
    • Hooks
      • useSession
      • useMobile
      • getSession
      • useFeature
      • useAuthorized
      • useNotification
      • useSocket
    • Localstorage
    • Errors
    • Internationalization (i18n)
    • Constants
    • Feature Flags
    • Testing
    • Telemetry
    • Deployment
    • Devtools (Alpha)
Powered by GitBook
On this page

Was this helpful?

  1. Novel Server
  2. Authentication

Magic Links

Last updated 5 months ago

Was this helpful?

Magic links are secure, time-sensitive URLs that enable passwordless authentication. When users request access, they receive a link via email that logs them in upon clicking. This eliminates the need for passwords, enhancing security and simplifying the user experience.

You can see the implementation below

You can create a different Magic Links flow by following this guide

Confugration

You will need to set up the after_login setting if you have changed the default page structure in Novel Web.

If you changed /web/app/(app)/dashboard to /web/app/(app)/apps for example, you will need to change the configuration in /config/auth.js .

config/auth.js
/**
 * Override the redirects here with the custom pages that you have so you can reference
 * them easily in your server code.
 */
routes: {
	login: '/login',
	mfa: '/login/mfa',
	forget: '/login/forget',
	link: '/login/link',
	verify: '/mail/verify',
	signup: '/signup',
	
	logout: '/logout',
},

API

You can use /auth/passwordless to perform a Magic Link flow.

Changelog

  • 2024-12-20 - Initial Documentation

https://github.com/madewithnovel/novel/blob/main/app/auth/passwordless.ts
https://github.com/madewithnovel/novel/blob/main/app/api/internal/v1/auth-passwordless/index.ts
Integrating an OAuth Provider | Novel
Logo

Auth Passwordless

get

Authenticate by passwordless strategy available to the application.

Responses
301
Authentication successful. Redirecting to next step...
application/json
Responseany

Authentication successful. Redirecting to next step...

get
GET /auth/passwordless/verify HTTP/1.1
Host: 
Accept: */*
301

Authentication successful. Redirecting to next step...

No content

  • Confugration
  • API
  • POSTAuth by Strategy
  • GETAuth Passwordless
  • Changelog

Auth by Strategy

post

Authenticate by strategy available to the application.

Path parameters
strategystringRequired
Body
emailstring ยท emailOptional
passwordstringOptional
Responses
200
Authentication successful. Redirecting to next step...
application/json
301
Authentication successful. Redirecting to next step...
application/json
post
POST /auth/{strategy} HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 44

{
  "email": "name@gmail.com",
  "password": "text"
}
{
  "redirect_to": "text"
}