From afc83bb2f896859cc566c74ecde65a7dbb50819d Mon Sep 17 00:00:00 2001 From: Kang Ming Date: Tue, 16 Apr 2024 00:27:23 +0700 Subject: [PATCH] docs: update anonymous sign-ins guide (#22752) --- .../content/guides/auth/auth-anonymous.mdx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/docs/content/guides/auth/auth-anonymous.mdx b/apps/docs/content/guides/auth/auth-anonymous.mdx index 091f8ec2848..30b6346f53f 100644 --- a/apps/docs/content/guides/auth/auth-anonymous.mdx +++ b/apps/docs/content/guides/auth/auth-anonymous.mdx @@ -4,13 +4,7 @@ title: 'Anonymous Sign-Ins' subtitle: 'Create and use anonymous users to authenticate with Supabase' --- -Enable Anonymous Sign-In to build apps which provide users an authenticated experience without requiring users to enter an email address, password, use an OAuth provider or provide any other PII (Personally Identifiable Information). Later, when ready, they can attach an authentication method to their account. - -It's most useful for: - -- E-commerce applications, such as shopping carts before check-out -- Full-feature demos without collecting personal information -- Temporary or throw-away accounts +[Enable Anonymous Sign-Ins](/dashboard/project/_/settings/auth) to build apps which provide users an authenticated experience without requiring users to enter an email address, password, use an OAuth provider or provide any other PII (Personally Identifiable Information). Later, when ready, the user can link an authentication method to their account. @@ -22,7 +16,11 @@ This is different from the `anon` API key which does not create a user and can b -To get started, [enable anonymous sign-ins](/dashboard/project/_/settings/auth) for your Supabase Project. +Anonymous sign-ins can be used to build: + +- E-commerce applications, such as shopping carts before check-out +- Full-feature demos without collecting personal information +- Temporary or throw-away accounts @@ -87,7 +85,7 @@ supabase.auth.signInAnonymously() ## Convert an anonymous user to a permanent user -Converting an anonymous user to a permanent user requires linking an identity to the user. +Converting an anonymous user to a permanent user requires [linking an identity](/docs/guides/auth/auth-identity-linking#manual-linking-beta) to the user. This requires you to [enable manual linking](/dashboard/project/_/settings/auth) in your Supabase project. ### Link an Email / Phone identity @@ -100,10 +98,16 @@ Converting an anonymous user to a permanent user requires linking an identity to > -You can use the [`updateUser()`](/docs/reference/javascript/auth-updateuser) method to link an email or phone identity to the anonymous user. +You can use the [`updateUser()`](/docs/reference/javascript/auth-updateuser) method to link an email or phone identity to the anonymous user. To add a password for the anonymous user, the user's email or phone number needs to be verified first. ```js const { data, error } = await supabase.auth.updateUser({ email: 'example@email.com' }) + +// verify the user's email by clicking on the email change link +// or entering the 6-digit OTP sent to the email address + +// once the user has been verified, update the password +const { data, error } = await supabase.auth.updateUser({ password: 'password' }) ```