🐛 (auth) Fix email magic link pointing to internal auth URL
Closes #403
This commit is contained in:
@ -1,14 +1,18 @@
|
||||
import { EmailConfig } from 'next-auth/providers/email'
|
||||
import { sendMagicLinkEmail } from '@typebot.io/emails'
|
||||
|
||||
type Props = {
|
||||
identifier: string
|
||||
url: string
|
||||
provider: Partial<Omit<EmailConfig, 'options'>>
|
||||
token: string
|
||||
}
|
||||
|
||||
export const sendVerificationRequest = async ({ identifier, url }: Props) => {
|
||||
export const sendVerificationRequest = async ({ identifier, token }: Props) => {
|
||||
try {
|
||||
const url = `${
|
||||
process.env.NEXTAUTH_URL
|
||||
}/api/auth/callback/email?${new URLSearchParams({
|
||||
email: identifier,
|
||||
token,
|
||||
}).toString()}`
|
||||
await sendMagicLinkEmail({ url, to: identifier })
|
||||
} catch (err) {
|
||||
throw new Error(`Email(s) could not be sent`)
|
||||
|
Reference in New Issue
Block a user