Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Update email and magic link auth guides

dannykng152a0d01e45b
diff --git a/apps/reference/docs/guides/auth/auth-email.mdx b/apps/reference/docs/guides/auth/auth-email.mdx
index d776dc8e6af..27c3f83874c 100644
--- a/apps/reference/docs/guides/auth/auth-email.mdx
+++ b/apps/reference/docs/guides/auth/auth-email.mdx
@@ -30,12 +30,7 @@ See the [self-hosting docs](/docs/guides/hosting/overview#configuration) for det
:::
-### Add login code to your client app
-
-Add logins using our client libraries:
-
-- [JavaScript](/docs/reference/javascript/auth-signin#sign-in-with-email)
-- [Dart](/docs/reference/dart/auth-signin#sign-in-with-email)
+## Add login code to your client app
<Tabs
defaultValue="js"
@@ -45,44 +40,11 @@ Add logins using our client libraries:
<TabItem value="js">
-```js
-const { user, error } = await supabase.auth.signIn({
- email: '[email protected]',
- password: 'example-password',
-})
-```
-
-</TabItem>
-
-<TabItem value="dart">
-
-```dart
-final res = await supabase.auth.signIn(
- email: '[email protected]',
- password: 'example-password'
-);
-
-final user = res.data?.user;
-final error = res.error;
-```
-
-</TabItem>
-
-</Tabs>
-
-Add this function which you can call from a button, link, or UI element.
-
-<Tabs
- defaultValue="js"
- groupId="guides/auth"
- values={[{ label: 'JavaScript', value: 'js' }, { label: 'Dart', value: 'dart' }]}
->
-
-<TabItem value="js">
+When your user signs in, call [signInWithPassword()](/docs/reference/javascript/auth-signinwithpassword) with their email address and password:
```js
async function signInWithEmail() {
- const { user, error } = await supabase.auth.signIn({
+ const { data, error } = await supabase.auth.signInWithPassword({
password: 'example-password',
})
@@ -93,6 +55,8 @@ async function signInWithEmail() {
<TabItem value="dart">
+When your user signs in, call [signIn()](/docs/reference/dart/auth-signin) with their email address and password:
+
```dart
Future<void> signInWithEmail() async {
await supabase.auth.signIn(
@@ -106,8 +70,6 @@ Future<void> signInWithEmail() async {
</Tabs>
-To log out:
-
<Tabs
defaultValue="js"
groupId="guides/auth"
@@ -116,6 +78,8 @@ To log out:
<TabItem value="js">
+When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
+
```js
async function signOut() {
const { error } = await supabase.auth.signOut()
@@ -126,6 +90,8 @@ async function signOut() {
<TabItem value="dart">
+When your user signs out, call [signOut()](/docs/reference/dart/auth-signout) to remove them from the browser session and any objects from localStorage:
+
```dart
Future<void> signOut() async {
await supabase.auth.signOut();
diff --git a/apps/reference/docs/guides/auth/auth-magic-link.mdx b/apps/reference/docs/guides/auth/auth-magic-link.mdx
index 5d320a55abe..391f1ad9365 100644
--- a/apps/reference/docs/guides/auth/auth-magic-link.mdx
+++ b/apps/reference/docs/guides/auth/auth-magic-link.mdx
@@ -1,13 +1,14 @@
---
id: auth-magic-link
title: 'Login With Magic Link'
-description: Use Supabase to Authenticate and Authorize your users using Magic Link.
+description: Use Supabase to authenticate and authorize your users using magic links.
---
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
-By default, if no password is provided, the user will be sent a "magic link" to their email address, which they can click to open your application with a valid session. By default, a given user can only request a Magic Link once every 60 seconds.
+Magic links are a form of passwordless logins where users click on a link sent to their email address to log in to their accounts.
+Magic links only work with email addresses. By default, a user can only request a magic link once every 60 seconds.
## Overview
@@ -25,12 +26,7 @@ Setting up Magic Link logins for your Supabase application.
- Under `Email Auth` turn `Enable Email Signup` to ON
- Click `Save`
-### Add login code to your client app
-
-Add logins using our client libraries:
-
-- [JavaScript](/docs/reference/javascript/auth-signin#sign-in-with-magic-link)
-- [Dart](/docs/reference/dart/auth-signin#sign-in-with-magic-link)
+## Add login code to your client app
<Tabs
defaultValue="js"
@@ -40,39 +36,11 @@ Add logins using our client libraries:
<TabItem value="js">
-```js
-const { user, error } = await supabase.auth.signIn({
- email: '[email protected]',
-})
-```
-
-</TabItem>
-
-<TabItem value="dart">
-
-```dart
-final res = await supabase.auth.signIn(email: '[email protected]');
-
-final error = res.error;
-```
-
-</TabItem>
-
-</Tabs>
-
-Add this function which you can call from a button, link, or UI element.
-
-<Tabs
- defaultValue="js"
- groupId="guides/auth"
- values={[{ label: 'JavaScript', value: 'js' }, { label: 'Dart', value: 'dart' }]}
->
-
-<TabItem value="js">
+When your user signs in, call [signInWithOtp()](/docs/reference/javascript/auth-signinwithotp) with their email address:
```js
async function signInWithEmail() {
- const { user, error } = await supabase.auth.signIn({
+ const { data, error } = await supabase.auth.signInWithOtp({
})
}
@@ -82,6 +50,8 @@ async function signInWithEmail() {
<TabItem value="dart">
+When your user signs in, call [signIn()](/docs/reference/dart/auth-signin) with their email address:
+
```dart
Future<void> signInWithEmail() async {
await supabase.auth.signIn(email: '[email protected]');
@@ -92,8 +62,6 @@ Future<void> signInWithEmail() async {
</Tabs>
-To log out:
-
<Tabs
defaultValue="js"
groupId="guides/auth"
@@ -102,6 +70,8 @@ To log out:
<TabItem value="js">
+When your user signs out, call [signOut()](/docs/reference/javascript/auth-signout) to remove them from the browser session and any objects from localStorage:
+
```js
async function signOut() {
const { error } = await supabase.auth.signOut()
@@ -112,6 +82,8 @@ async function signOut() {
<TabItem value="dart">
+When your user signs out, call [signOut()](/docs/reference/dart/auth-signout) to remove them from the browser session and any objects from localStorage:
+
```dart
Future<void> signOut() async {
await supabase.auth.signOut();