diff --git a/apps/docs/content/guides/auth/auth-mfa/webauthn.mdx b/apps/docs/content/guides/auth/auth-mfa/webauthn.mdx index 5e33e0aff31..ae7b9985443 100644 --- a/apps/docs/content/guides/auth/auth-mfa/webauthn.mdx +++ b/apps/docs/content/guides/auth/auth-mfa/webauthn.mdx @@ -90,7 +90,7 @@ You can enroll a WebAuthn factor with a single step: ```ts import { browserSupportsWebAuthn } from '@supabase/supabase-js' if (supabase.auth.browserSupportsWebAuthn()) { - const { data, error } = await supabase.auth.mfa.enroll({ factorType: 'webauthn'}) + const { data, error } = await supabase.auth.mfa.enroll({ factorType: 'webauthn', friendlyName: 'my-friendly-name'}) }) ``` @@ -120,67 +120,6 @@ const credential = await navigator.credentials.create(data) const { data, error } = await supabase.auth.mfa.verify({ factorId, credential }) ``` -Verification is often done on a page with a single button. - -```ts -export default function MFAWebAuthn() { - const [error, setError] = useState(null) - const [isAuthenticating, setIsAuthenticating] = useState(false) - const navigate = useNavigate() - - useEffect(() => { - startAuthentication() - }, []) - - const startAuthentication = async () => { - setIsAuthenticating(true) - setError(null) - - try { - const { data, error: authError } = await supabase.auth.mfa.verify({ - factorType: 'webauthn' - }) - - if (authError) throw authError - - console.log('Authentication successful', data) - // Handle successful authentication here - // For example, navigate to protected route: - // navigate('/dashboard') - - } catch (err) { - setError(err.message) - } finally { - setIsAuthenticating(false) - } - } - - return ( -
Please verify your identity using your security key.
- - {error && ( -Error: {error}
-Follow your browser's instructions to continue
+ + {error && ( +Error: {error}
+