[PR #7224] feat(magic-link): add generateMagicLink endpoint #7156

Open
opened 2026-03-13 13:26:01 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7224
Author: @himself65
Created: 1/9/2026
Status: 🔄 Open

Base: canaryHead: himself65/2026/01/09/endpoint


📝 Commits (1)

  • d18ce48 feat(magic-link): add generateMagicLink endpoint

📊 Changes

2 files changed (+176 additions, -31 deletions)

View changed files

📝 packages/better-auth/src/plugins/magic-link/index.ts (+77 -31)
📝 packages/better-auth/src/plugins/magic-link/magic-link.test.ts (+99 -0)

📄 Description

Summary by cubic

Added a POST /generate-magic-link endpoint to create magic link URLs and tokens without sending emails. Also updated magic link verification to return full user and session data, including additional fields.

  • New Features

    • Added POST /generate-magic-link returning { url, token } with OpenAPI metadata.
    • Extracted shared createMagicLink logic used by both generation and email flows.
  • Bug Fixes

    • /magic-link/verify now uses parseUserOutput and parseSessionOutput, exposing additional user fields and session when no callbackURL is provided.

Written for commit d18ce48e7b. Summary will update on new commits.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/7224 **Author:** [@himself65](https://github.com/himself65) **Created:** 1/9/2026 **Status:** 🔄 Open **Base:** `canary` ← **Head:** `himself65/2026/01/09/endpoint` --- ### 📝 Commits (1) - [`d18ce48`](https://github.com/better-auth/better-auth/commit/d18ce48e7b74ed8db43cce673857ac25779220b9) feat(magic-link): add `generateMagicLink` endpoint ### 📊 Changes **2 files changed** (+176 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/plugins/magic-link/index.ts` (+77 -31) 📝 `packages/better-auth/src/plugins/magic-link/magic-link.test.ts` (+99 -0) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Added a POST /generate-magic-link endpoint to create magic link URLs and tokens without sending emails. Also updated magic link verification to return full user and session data, including additional fields. - **New Features** - Added POST /generate-magic-link returning { url, token } with OpenAPI metadata. - Extracted shared createMagicLink logic used by both generation and email flows. - **Bug Fixes** - /magic-link/verify now uses parseUserOutput and parseSessionOutput, exposing additional user fields and session when no callbackURL is provided. <sup>Written for commit d18ce48e7b74ed8db43cce673857ac25779220b9. Summary will update on new commits.</sup> <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 13:26:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#7156