英文:
Supabase Email Redirect
问题
如何在用户创建帐户后,在确认电子邮件中创建动态重定向链接?
例如:
如果某个用户通过链接www.website.com/project/1或/project/2等访问网站。
并且他没有帐户,需要创建一个。注册后,用户需要通过电子邮件确认帐户,确认后用户将在新标签页中重定向到www.website.com/。
如何设置电子邮件动态重定向链接以将用户重定向到特定的嵌套路由?
英文:
How can I make dynamic redirect link in confirmation email after user create account?
For example:
If some user gets to the web site using link www.website.com/project/1 or /project/2 etc.
And it doesn't have account and needs to make one. After sign up, user needs to confirm account via email, after confirmation user gets redirected to www.website.com/ in a new tab.
How can I setup email dynamic redirect link to redirect the user to specific nested route?
答案1
得分: 1
你可以将emailRedirectTo
设置为您想要跳转到的页面的完整网址。
await supabase.auth.signUp({ email, password,
options: {
emailRedirectTo: 'http://example.com/project/1' // 需要根据您使用的框架以动态方式创建项目部分。
}
})
您还需要将这些网址添加到重定向URL允许列表中。https://app.supabase.com/project/_/auth/url-configuration
英文:
You can pass the emailRedirectTo
a full url to the page you want it to go to.
await supabase.auth.signUp({ email, password,
options: {
emailRedirectTo: 'http://example.com/project/1' // you will have to make the project part dynamic in whichever way the framework you are using allows you to do this.
}
})
You will also need to add these URLs to the Redirect URLs allow list. https://app.supabase.com/project/_/auth/url-configuration
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论