Get magic link without sending an email

I need to extract the URL directly from the request on the backend, but I’m not sure if it’s even possible since the function doesn’t provide any URL or token parameters.
Solution:
Yeah your best bet is to use your ORM. It would be silly of us if we returned the link in the response of that endpoint
Jump to solution
6 Replies
Hexi
HexiOP2mo ago
No description
Hexi
HexiOP2mo ago
or where is the token stored? So I can manually get it
Hexi
HexiOP2mo ago
This seems to be working however its quite yank
No description
Solution
Ping
Ping2mo ago
Yeah your best bet is to use your ORM. It would be silly of us if we returned the link in the response of that endpoint
Hexi
HexiOP2mo ago
Yeah fair enough. also quick question is it possible to not invalidate the magic link after usage?
Ping
Ping2mo ago
Umm I don't think there is some built-in behavour that does that. But it's possible to write a workaround by making it redirect to a custom page of your own, validate the magic link using our APIs (https://www.better-auth.com/docs/plugins/magic-link#verify-magic-link), then insert a clone of that row into the DB making the link still valid.

Did you find this page helpful?