Skip to content

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

docs: fix phone auth guides. (#18846)

Thor 雷神 Schaeffc05d56bd9177
diff --git a/apps/docs/pages/guides/auth/phone-login/messagebird.mdx b/apps/docs/pages/guides/auth/phone-login/messagebird.mdx
index c0f620d9851..3d37e28a26b 100644
--- a/apps/docs/pages/guides/auth/phone-login/messagebird.mdx
+++ b/apps/docs/pages/guides/auth/phone-login/messagebird.mdx
@@ -92,7 +92,10 @@ In this use scenario we'll be using the user's mobile phone number as an alterna
Using supabase-js on the client you'll want to use the same `signUp` method that you'd use for email based sign ups, but with the `phone` param instead of the `email param`:
```js
-const { user, error } = await supabase.auth.signUp({
+const {
+ data: { user, session },
+ error,
+} = await supabase.auth.signUp({
phone: '+13334445555',
password: 'some-password',
})
@@ -138,7 +141,10 @@ The user will now receive an SMS with a 6-digit pin that you will need to receiv
You should present a form to the user so they can input the 6 digit pin, then send it along with the phone number to `verifyOtp`:
```js
-const { session, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '+13334445555',
token: '123456',
})
@@ -247,7 +253,7 @@ In this scenario you are granting your user's the ability to login to their acco
In JavaScript we can use the `signIn` method with a single parameter: `phone`
```js
-const { user, error } = await supabase.auth.signInWithOtp({
+const { data, error } = await supabase.auth.signInWithOtp({
phone: '+13334445555',
})
```
@@ -290,7 +296,10 @@ The second step is the same as the previous section, you need to collect the 6-d
<TabPanel id="js" label="JavaScript">
```js
-const { session, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '+13334445555',
token: '123456',
})
diff --git a/apps/docs/pages/guides/auth/phone-login/twilio.mdx b/apps/docs/pages/guides/auth/phone-login/twilio.mdx
index 9f439332d6b..12516dae018 100644
--- a/apps/docs/pages/guides/auth/phone-login/twilio.mdx
+++ b/apps/docs/pages/guides/auth/phone-login/twilio.mdx
@@ -146,7 +146,10 @@ In this scenario we'll be using the user's mobile phone number and a correspondi
Using supabase-js on the client you'll want to use the same `signUp` method that you'd use for email based sign ups, but with the `phone` param instead of the `email param`:
```js
-const { user, error } = await supabase.auth.signUp({
+const {
+ data: { user, session },
+ error,
+} = await supabase.auth.signUp({
phone: '+13334445555',
password: 'some-password',
})
@@ -192,7 +195,10 @@ The user will now receive an SMS with a 6-digit pin that you will need to receiv
You should present a form to the user so they can input the 6 digit pin, then send it along with the phone number to `verifyOtp`:
```js
-const { session, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '+13334445555',
token: '123456',
type: 'sms',
@@ -302,7 +308,7 @@ In this scenario you are granting your user's the ability to login to their acco
In JavaScript we can use the `signIn` method with a single parameter: `phone`
```js
-const { user, error } = await supabase.auth.signInWithOtp({
+const { data, error } = await supabase.auth.signInWithOtp({
phone: '+13334445555',
})
```
@@ -345,7 +351,10 @@ The second step is the same as the previous section, you need to collect the 6-d
<TabPanel id="js" label="JavaScript">
```js
-const { session, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '+13334445555',
token: '123456',
type: 'sms',
@@ -446,7 +455,10 @@ There is no change in the verification process, you should continue to use the `
```js
// After receiving a WhatsApp OTP
-const { data, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '+57336567365',
token: '123456',
type: 'sms',
diff --git a/apps/docs/pages/guides/auth/phone-login/vonage.mdx b/apps/docs/pages/guides/auth/phone-login/vonage.mdx
index 60edc1b9323..b45c7b05671 100644
--- a/apps/docs/pages/guides/auth/phone-login/vonage.mdx
+++ b/apps/docs/pages/guides/auth/phone-login/vonage.mdx
@@ -87,7 +87,10 @@ In this use scenario we'll be using the user's mobile phone number as an alterna
Using supabase-js on the client you'll want to use the same `signUp` method that you'd use for email based sign ups, but with the `phone` param instead of the `email param`:
```js
-const { user, error } = await supabase.auth.signUp({
+const {
+ data: { user, session },
+ error,
+} = await supabase.auth.signUp({
phone: '491512223334444',
password: 'some-password',
})
@@ -133,7 +136,10 @@ The user will now receive an SMS with a 6-digit pin that you will need to receiv
You should present a form to the user so they can input the 6 digit pin, then send it along with the phone number to `verifyOtp`:
```js
-const { session, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '491512223334444',
token: '123456',
})
@@ -242,7 +248,7 @@ In this scenario you are granting your user's the ability to login to their acco
In JavaScript we can use the `signIn` method with a single parameter: `phone`
```js
-const { user, error } = await supabase.auth.signInWithOtp({
+const { data, error } = await supabase.auth.signInWithOtp({
phone: '491512223334444',
})
```
@@ -285,7 +291,10 @@ The second step is the same as the previous section, you need to collect the 6-d
<TabPanel id="js" label="JavaScript">
```js
-const { session, error } = await supabase.auth.verifyOtp({
+const {
+ data: { session },
+ error,
+} = await supabase.auth.verifyOtp({
phone: '491512223334444',
token: '123456',
})