[GH-ISSUE #2464] Unable to use magicLink.verify in Astro server island #17835

Closed
opened 2026-04-15 16:10:43 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @adesege on GitHub (Apr 27, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/2464

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Create a new astro project
  2. Use magicLink.verify in server context
  3. When successful, it doesn't redirect to the callback url nor does it set the appropriate cookie

Current vs. Expected behavior

The expected behavior is for the user to either be redirected to the callback url when magicLink.verify succeeds and sets the appropriate session cookie in server context. Alternatively, a raw response can be returned so that the redirect and cookie setting can be handled on the server.

Additionally, when magicLink.verify is used on client side and the request is successful, the page doesn't redirect although the cookie is set.

What version of Better Auth are you using?

1.2.7

Provide environment information

- Chrome
- MacOS

Which area(s) are affected? (Select all that apply)

Client

Auth config (if applicable)

import { betterAuth } from "better-auth"
export const auth = betterAuth({
  plugins: [
      magicLink({
        sendMagicLink: async ({ email, token, url }) => {
          await sendMagicLink(context, { email, token, url });
        }
      })
    ],
});

Additional context

No response

Originally created by @adesege on GitHub (Apr 27, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/2464 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce 1. Create a new astro project 2. Use magicLink.verify in server context 3. When successful, it doesn't redirect to the callback url nor does it set the appropriate cookie ### Current vs. Expected behavior The expected behavior is for the user to either be redirected to the callback url when magicLink.verify succeeds and sets the appropriate session cookie in server context. Alternatively, a raw response can be returned so that the redirect and cookie setting can be handled on the server. Additionally, when magicLink.verify is used on client side and the request is successful, the page doesn't redirect although the cookie is set. ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - Chrome - MacOS ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ plugins: [ magicLink({ sendMagicLink: async ({ email, token, url }) => { await sendMagicLink(context, { email, token, url }); } }) ], }); ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-15 16:10:43 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jul 27, 2025):

Hi, @adesege. I'm Dosu, and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale.

Issue Summary:

  • Problem with magicLink.verify function in Better Auth version 1.2.7.
  • Fails to redirect to callback URL or set session cookie correctly in Astro server context.
  • Occurs on Chrome and MacOS.
  • No further activity or comments have been made on the issue.

Next Steps:

  • Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here.
  • If no updates are provided, the issue will be automatically closed in 7 days.

Thank you for your understanding and contribution!

<!-- gh-comment-id:3124510924 --> @dosubot[bot] commented on GitHub (Jul 27, 2025): Hi, @adesege. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog. I'm marking this issue as stale. **Issue Summary:** - Problem with `magicLink.verify` function in Better Auth version 1.2.7. - Fails to redirect to callback URL or set session cookie correctly in Astro server context. - Occurs on Chrome and MacOS. - No further activity or comments have been made on the issue. **Next Steps:** - Please confirm if this issue is still relevant to the latest version of the better-auth repository by commenting here. - If no updates are provided, the issue will be automatically closed in 7 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#17835