admin管理员组文章数量:1332345
How can I check if a user with the same email already exists when Enable email confirmations is turned on.
When Enable email confirmations are turned on an obfuscated / fake user object is returned by supabase, according to this ment it's a feature.
How can I check if the email already exists without turning off Email confirmation?
I tried passing using supabase.auth.api.getUser
, but that needs JWT, not the user id
.
How can I check if a user with the same email already exists when Enable email confirmations is turned on.
When Enable email confirmations are turned on an obfuscated / fake user object is returned by supabase, according to this ment it's a feature.
How can I check if the email already exists without turning off Email confirmation?
I tried passing using supabase.auth.api.getUser
, but that needs JWT, not the user id
.
- 1 interesting choice but according to github./supabase/supabase-js/issues/… you shouldn't need to check since the user is redirected via mail back to your application – zapl Commented Sep 21, 2022 at 16:42
3 Answers
Reset to default 7Not sure if following is the correct way but I do it as follows (TypeScript):
const [errorMsg, setErrorMsg] = useState<string | null>(null);
const [successMsg, setSuccessMsg] = useState<string | null>(null);
async function signUp(formData: Values) {
const { data, error } = await supabase.auth.signUp({
email: formData.email,
password: formData.password,
});
if (error) {
setErrorMsg(error.message);
} else if (data.user?.identities?.length === 0) {
setErrorMsg('User already registered');
} else {
setSuccessMsg('Success! Please check your inbox.');
}
}
data.user?.identities?.length
is 0 when the user is registered already.
Just go to providers and disable phone confirmation even if phone provider is disabled. Then you will get it in errors field. That user_already_exists
https://supabase./docs/reference/javascript/auth-signup
Going to the providers section and disabling phone confirmation fixes the issue, make sure to disable the phone confirmation and not just the phone provider, doing these will result in supabase finally giving the user already registered error.
Disabling The Phone Confirmation Under Providers (Phone)
本文标签: javascriptHow to check if user already exists in SupabaseStack Overflow
版权声明:本文标题:javascript - How to check if user already exists in Supabase? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742326436a2453822.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论