Generate magic link in PostgreSQL function
Hey! I want to send users a custom email with an action button (e.g., "Confirm" or "Open") that:
Is it possible to generate a token/code (like a magic link) directly in PostgreSQL that I can include in the email to automatically log users in when they click the link? If not is there any other way to achieve this like switching to edge functions?
For example:
Any help or suggestions would be greatly appreciated!
- Automatically logs them in when clicked
(The below ones I have already figured out) - Records their action
- Redirects to confirmation
- Backend logic and Email templates are generated in supabase PostgreSQL functions
- Frontend with SvelteKit(Javascript)
Is it possible to generate a token/code (like a magic link) directly in PostgreSQL that I can include in the email to automatically log users in when they click the link? If not is there any other way to achieve this like switching to edge functions?
For example:
https://website.app/action?action_id=22&token=somethingToLoginTheUserAny help or suggestions would be greatly appreciated!