diff --git a/src/GoTrueClient.ts b/src/GoTrueClient.ts index 6f7364a92..550d91dd9 100644 --- a/src/GoTrueClient.ts +++ b/src/GoTrueClient.ts @@ -2341,7 +2341,7 @@ export default class GoTrueClient { return { data: null, error: sessionError } } - if (params.factorType === 'sms') { + if (params.factorType === 'phone') { const { data, error } = await _request(this.fetch, 'POST', `${this.url}/factors`, { body: { friendly_name: params.friendlyName, @@ -2497,11 +2497,15 @@ export default class GoTrueClient { const totp = factors.filter( (factor) => factor.factor_type === 'totp' && factor.status === 'verified' ) + const phone = factors.filter( + (factor) => factor.factor_type === 'phone' && factor.status === 'verified' + ) return { data: { all: factors, totp, + phone, }, error: null, } diff --git a/src/lib/types.ts b/src/lib/types.ts index 76260114b..45818223c 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -816,7 +816,7 @@ export type MFAEnrollParams = } | { /** The type of factor being enrolled. */ - factorType: 'sms' + factorType: 'phone' /** Human readable name assigned to the factor. */ friendlyName?: string /** Phone number associated with a factor */ @@ -916,7 +916,7 @@ export type AuthMFAEnrollResponse = id: string /** Type of MFA factor. Only `totp` supported for now. */ - type: 'sms' + type: 'phone' /** Friendly name of the factor, useful for distinguishing between factors **/ friendly_name?: string @@ -962,6 +962,8 @@ export type AuthMFAListFactorsResponse = /** Only verified TOTP factors. (A subset of `all`.) */ totp: Factor[] + /** Only verified Phone factors. (A subset of `all`.) */ + phone: Factor[] } error: null }