Supabase Email Redirect

huangapple go评论123阅读模式
英文:

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

huangapple
  • 本文由 发表于 2023年6月6日 03:53:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/76409602.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定