Skip to content

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

Revert "Revert "feat: update studio config to include twilio verify""

Joel Leec095c856c6a9
diff --git a/studio/components/interfaces/Auth/Auth.types.ts b/studio/components/interfaces/Auth/Auth.types.ts
index 3c4118ec83b..55b756c31bd 100644
--- a/studio/components/interfaces/Auth/Auth.types.ts
+++ b/studio/components/interfaces/Auth/Auth.types.ts
@@ -137,6 +137,9 @@ export interface AuthConfig {
SMS_TWILIO_ACCOUNT_SID: string
SMS_TWILIO_AUTH_TOKEN: string
SMS_TWILIO_MESSAGE_SERVICE_SID: string
+ SMS_TWILIO_VERIFY_ACCOUNT_SID: string
+ SMS_TWILIO_VERIFY_AUTH_TOKEN: string
+ SMS_TWILIO_VERIFY_MESSAGE_SERVICE_SID: string
SMS_VONAGE_API_KEY: string
SMS_VONAGE_API_SECRET: string
SMS_VONAGE_FROM: string
diff --git a/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx
index ddb160631fb..a9665541e76 100644
--- a/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx
+++ b/studio/components/interfaces/Auth/AuthProvidersForm/FormField.tsx
@@ -14,7 +14,8 @@ interface Props {
const FormField: FC<Props> = ({ name, properties, formValues, disabled = false }) => {
const [hidden, setHidden] = useState(!!properties.isSecret)
- if (properties.show && formValues[properties.show.key] !== properties.show.matches) return null
+ if (properties.show && !properties.show.matches.includes(formValues[properties.show.key]))
+ return null
switch (properties.type) {
case 'string':
diff --git a/studio/pages/api/auth/[ref]/config.ts b/studio/pages/api/auth/[ref]/config.ts
index 80f655a588d..34878dd37f3 100644
--- a/studio/pages/api/auth/[ref]/config.ts
+++ b/studio/pages/api/auth/[ref]/config.ts
@@ -106,7 +106,6 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
EXTERNAL_ZOOM_ENABLED: false,
EXTERNAL_ZOOM_CLIENT_ID: null,
EXTERNAL_ZOOM_SECRET: null,
-
MAILER_SUBJECTS_INVITE: 'You have been invited',
MAILER_SUBJECTS_CONFIRMATION: 'Confirm Your Signup',
MAILER_SUBJECTS_RECOVERY: 'Reset Your Password',
@@ -137,6 +136,9 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
SMS_TWILIO_ACCOUNT_SID: null,
SMS_TWILIO_AUTH_TOKEN: null,
SMS_TWILIO_MESSAGE_SERVICE_SID: null,
+ SMS_TWILIO_VERIFY_ACCOUNT_SID: null,
+ SMS_TWILIO_VERIFY_AUTH_TOKEN: null,
+ SMS_TWILIO_VERIFY_MESSAGE_SERVICE_SID: null,
SMS_TEMPLATE: 'Your code is {{ .Code }}',
SECURITY_CAPTCHA_ENABLED: false,
SECURITY_CAPTCHA_PROVIDER: 'hcaptcha',
diff --git a/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx b/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx
index 48eefc8e24e..8771c1ca075 100644
--- a/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx
+++ b/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx
@@ -81,6 +81,7 @@ const PROVIDER_PHONE = {
{ label: 'Messagebird', value: 'messagebird', icon: 'messagebird-icon.svg' },
{ label: 'Textlocal', value: 'textlocal', icon: 'textlocal-icon.png' },
{ label: 'Vonage', value: 'vonage', icon: 'vonage-icon.svg' },
+ { label: 'Twilio Verify', value: 'twilio-verify', icon: 'twilio-icon.svg' }
],
},
RATE_LIMIT_SMS_SENT: {
@@ -95,7 +96,7 @@ const PROVIDER_PHONE = {
title: 'Twilio Account Sid',
show: {
key: 'SMS_PROVIDER',
- matches: 'twilio',
+ matches: ['twilio'],
},
},
SMS_TWILIO_AUTH_TOKEN: {
@@ -104,7 +105,7 @@ const PROVIDER_PHONE = {
isSecret: true,
show: {
key: 'SMS_PROVIDER',
- matches: 'twilio',
+ matches: ['twilio'],
},
},
SMS_TWILIO_MESSAGE_SERVICE_SID: {
@@ -112,7 +113,34 @@ const PROVIDER_PHONE = {
title: 'Twilio Message Service Sid',
show: {
key: 'SMS_PROVIDER',
- matches: 'twilio',
+ matches: ['twilio'],
+ },
+ },
+
+ // Twilio Verify
+ SMS_TWILIO_VERIFY_ACCOUNT_SID: {
+ type: 'string',
+ title: 'Twilio Account Sid',
+ show: {
+ key: 'SMS_PROVIDER',
+ matches: ['twilio-verify'],
+ },
+ },
+ SMS_TWILIO_VERIFY_AUTH_TOKEN: {
+ type: 'string',
+ title: 'Twilio Auth Token',
+ isSecret: true,
+ show: {
+ key: 'SMS_PROVIDER',
+ matches: ['twilio-verify'],
+ },
+ },
+ SMS_TWILIO_VERIFY_MESSAGE_SERVICE_SID: {
+ type: 'string',
+ title: 'Twilio Message Service Sid',
+ show: {
+ key: 'SMS_PROVIDER',
+ matches: ['twilio-verify'],
},
},
@@ -122,7 +150,7 @@ const PROVIDER_PHONE = {
title: 'Messagebird Access Key',
show: {
key: 'SMS_PROVIDER',
- matches: 'messagebird',
+ matches: ['messagebird'],
},
},
SMS_MESSAGEBIRD_ORIGINATOR: {
@@ -130,7 +158,7 @@ const PROVIDER_PHONE = {
title: 'Messagebird Originator',
show: {
key: 'SMS_PROVIDER',
- matches: 'messagebird',
+ matches: ['messagebird'],
},
},
@@ -140,7 +168,7 @@ const PROVIDER_PHONE = {
title: 'Textlocal API Key',
show: {
key: 'SMS_PROVIDER',
- matches: 'textlocal',
+ matches: ['textlocal'],
},
},
SMS_TEXTLOCAL_SENDER: {
@@ -148,7 +176,7 @@ const PROVIDER_PHONE = {
title: 'Textlocal Sender',
show: {
key: 'SMS_PROVIDER',
- matches: 'textlocal',
+ matches: ['textlocal'],
},
},
@@ -158,7 +186,7 @@ const PROVIDER_PHONE = {
title: 'Vonage API Key',
show: {
key: 'SMS_PROVIDER',
- matches: 'vonage',
+ matches: ['vonage'],
},
},
SMS_VONAGE_API_SECRET: {
@@ -166,7 +194,7 @@ const PROVIDER_PHONE = {
title: 'Vonage API Secret',
show: {
key: 'SMS_PROVIDER',
- matches: 'vonage',
+ matches: ['vonage'],
},
},
// [TODO] verify what this is?
@@ -175,7 +203,7 @@ const PROVIDER_PHONE = {
title: 'Vonage From',
show: {
key: 'SMS_PROVIDER',
- matches: 'vonage',
+ matches: ['vonage'],
},
},
@@ -191,17 +219,29 @@ const PROVIDER_PHONE = {
type: 'number',
description: 'Duration before an SMS OTP expires',
units: 'seconds',
+ show: {
+ key: 'SMS_PROVIDER',
+ matches: ['twilio', 'messagebird', 'textlocal', 'vonage']
+ }
},
SMS_OTP_LENGTH: {
title: 'SMS OTP Length',
type: 'number',
description: 'Number of digits in OTP',
units: 'digits',
+ show: {
+ key: 'SMS_PROVIDER',
+ matches: ['twilio', 'messagebird', 'textlocal', 'vonage']
+ }
},
SMS_TEMPLATE: {
title: 'SMS Message',
type: 'string',
description: 'To format the OTP code use `{{ .Code }}`',
+ show: {
+ key: 'SMS_PROVIDER',
+ matches: ['twilio', 'messagebird', 'textlocal', 'vonage']
+ }
},
},
validationSchema: object().shape({
@@ -231,6 +271,29 @@ const PROVIDER_PHONE = {
otherwise: (schema) => schema,
}),
+ // Twilio Verify
+ SMS_TWILIO_VERIFY_ACCOUNT_SID: string().when(['EXTERNAL_PHONE_ENABLED', 'SMS_PROVIDER'], {
+ is: (EXTERNAL_PHONE_ENABLED: boolean, SMS_PROVIDER: string) => {
+ return EXTERNAL_PHONE_ENABLED && SMS_PROVIDER === 'twilio-verify'
+ },
+ then: (schema) => schema.required('Twilio Verify Account SID is required'),
+ otherwise: (schema) => schema,
+ }),
+ SMS_TWILIO_VERIFY_AUTH_TOKEN: string().when(['EXTERNAL_PHONE_ENABLED', 'SMS_PROVIDER'], {
+ is: (EXTERNAL_PHONE_ENABLED: boolean, SMS_PROVIDER: string) => {
+ return EXTERNAL_PHONE_ENABLED && SMS_PROVIDER === 'twilio-verify'
+ },
+ then: (schema) => schema.required('Twilio Verify Auth Token is required'),
+ otherwise: (schema) => schema,
+ }),
+ SMS_TWILIO_VERIFY_MESSAGE_SERVICE_SID: string().when(['EXTERNAL_PHONE_ENABLED', 'SMS_PROVIDER'], {
+ is: (EXTERNAL_PHONE_ENABLED: boolean, SMS_PROVIDER: string) => {
+ return EXTERNAL_PHONE_ENABLED && SMS_PROVIDER === 'twilio-verify'
+ },
+ then: (schema) => schema.required('Twilio Verify Service SID is required'),
+ otherwise: (schema) => schema,
+ }),
+
// Messagebird
SMS_MESSAGEBIRD_ACCESS_KEY: string().when(['EXTERNAL_PHONE_ENABLED', 'SMS_PROVIDER'], {
is: (EXTERNAL_PHONE_ENABLED: boolean, SMS_PROVIDER: string) => {
diff --git a/studio/stores/jsonSchema/auth_gotrue_config.json b/studio/stores/jsonSchema/auth_gotrue_config.json
index e190bc15bac..9d820c8d39b 100644
--- a/studio/stores/jsonSchema/auth_gotrue_config.json
+++ b/studio/stores/jsonSchema/auth_gotrue_config.json
@@ -543,6 +543,19 @@
"type": "string",
"help": "Twilio message service SID or twilio phone number"
},
+ "SMS_TWILIO_VERIFY_ACCOUNT_SID": {
+ "title": "Twilio account SID",
+ "type": "string"
+ },
+ "SMS_TWILIO_VERIFY_AUTH_TOKEN": {
+ "title": "Twilio Verify auth token",
+ "type": "string"
+ },
+ "SMS_TWILIO_VERIFY_MESSAGE_SERVICE_SID": {
+ "title": "Twilio Verify service SID",
+ "type": "string",
+ "help": "Twilio Verify service SID"
+ },
"SMS_MESSAGEBIRD_ACCESS_KEY": {
"title": "Messagebird access key",
"type": "string"