Skip to content

Commit b6b906c

Browse files
Guilherme SouzaChrisChinchilla
andauthored
docs: add flutter phone factor reference doc and example (supabase#37828)
* docs: add flutter phone factor reference doc and example * Update apps/docs/spec/supabase_dart_v2.yml Co-authored-by: Chris Chinchilla <[email protected]> * Update apps/docs/spec/supabase_js_v2.yml Co-authored-by: Chris Chinchilla <[email protected]> * Update apps/docs/spec/supabase_dart_v2.yml Co-authored-by: Chris Chinchilla <[email protected]> * Update apps/docs/spec/supabase_dart_v2.yml Co-authored-by: Chris Chinchilla <[email protected]> --------- Co-authored-by: Chris Chinchilla <[email protected]>
1 parent cfc99d7 commit b6b906c

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

apps/docs/spec/supabase_dart_v2.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1633,9 +1633,9 @@ functions:
16331633
notes: |
16341634
This section contains methods commonly used for Multi-Factor Authentication (MFA) and are invoked behind the `supabase.auth.mfa` namespace.
16351635
1636-
Currently, we only support time-based one-time password (TOTP) as the 2nd factor. We don't support recovery codes but we allow users to enroll more than 1 TOTP factor, with an upper limit of 10.
1636+
Currently, Supabase supports time-based one-time password (TOTP) and phone verification code as the 2nd factor. Recovery codes are not supported but users can enroll multiple factors, with an upper limit of 10..
16371637
1638-
Having a 2nd TOTP factor for recovery means the user doesn't have to store their recovery codes. It also reduces the attack surface since the recovery factor is usually time-limited and not a single static code.
1638+
Having a 2nd factor for recovery frees the user of the burden of having to store their recovery codes somewhere. It also reduces the attack surface since multiple recovery codes are usually generated compared to just having 1 backup factor.
16391639
16401640
Learn more about implementing MFA on your application on our guide [here](https://supabase.com/docs/guides/auth/auth-mfa#overview).
16411641
- id: mfa-enroll
@@ -1644,7 +1644,7 @@ functions:
16441644
Starts the enrollment process for a new Multi-Factor Authentication (MFA) factor. This method creates a new `unverified` factor.
16451645
To verify a factor, present the QR code or secret to the user and ask them to add it to their authenticator app.
16461646
The user has to enter the code from their authenticator app to verify it.
1647-
- Currently, `totp` is the only supported `factorType`. The returned `id` should be used to create a challenge.
1647+
- Use `totp` or `phone` as the `factorType` and the returned `id` to create a challenge.
16481648
- To create a challenge, see [`mfa.challenge()`](/docs/reference/dart/auth-mfa-challenge).
16491649
- To verify a challenge, see [`mfa.verify()`](/docs/reference/dart/auth-mfa-verify).
16501650
- To create and verify a challenge in a single step, see [`mfa.challengeAndVerify()`](/docs/reference/dart/auth-mfa-challengeandverify).
@@ -1661,6 +1661,10 @@ functions:
16611661
isOptional: true
16621662
type: String
16631663
description: Human readable name assigned to the factor.
1664+
- name: phone
1665+
isOptional: true
1666+
type: String
1667+
description: Phone number to enroll for phone factor type.
16641668
examples:
16651669
- id: enroll-totp-factor
16661670
name: Enroll a time-based, one-time password (TOTP) factor
@@ -1681,6 +1685,27 @@ functions:
16811685
secret: '<SECRET>',
16821686
uri: '<URI>',
16831687
),
1688+
phone: null,
1689+
);
1690+
```
1691+
- id: enroll-phone-factor
1692+
name: Enroll a Phone Factor
1693+
isSpotlight: true
1694+
code: |
1695+
```dart
1696+
final res = await supabase.auth.mfa.enroll(factorType: FactorType.phone, phone: '+1234567890');
1697+
1698+
final phone = res.phone;
1699+
```
1700+
response: |
1701+
```json
1702+
AuthMFAEnrollResponse(
1703+
id: '<ID>',
1704+
type: FactorType.phone,
1705+
totp: null,
1706+
phone: PhoneEnrollment(
1707+
phone: '+1234567890',
1708+
),
16841709
);
16851710
```
16861711
- id: mfa-challenge

apps/docs/spec/supabase_js_v2.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,6 +2128,8 @@ functions:
21282128
Currently, there is support for time-based one-time password (TOTP) and phone verification code as the 2nd factor. Recovery codes are not supported but users can enroll multiple factors, with an upper limit of 10.
21292129
21302130
Having a 2nd factor for recovery frees the user of the burden of having to store their recovery codes somewhere. It also reduces the attack surface since multiple recovery codes are usually generated compared to just having 1 backup factor.
2131+
2132+
Learn more about implementing MFA in your application [in the MFA guide](https://supabase.com/docs/guides/auth/auth-mfa#overview).
21312133
- id: mfa-enroll
21322134
title: 'mfa.enroll()'
21332135
$ref: '@supabase/auth-js.GoTrueMFAApi.enroll'

0 commit comments

Comments
 (0)