Skip to content

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

fix: add new slack provider & deprecate old one (#27864)

Kang Ming5e83aa3c18d9
diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx
index 8d42b83fa3c..edda3ac3ace 100644
--- a/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx
+++ b/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx
@@ -12,7 +12,17 @@ import { useCustomDomainsQuery } from 'data/custom-domains/custom-domains-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { BASE_PATH } from 'lib/constants'
import { Check, ChevronUp } from 'lucide-react'
-import { Alert, Button, Collapsible, Form, Input } from 'ui'
+import {
+ Alert,
+ Alert_Shadcn_,
+ AlertDescription_Shadcn_,
+ AlertTitle_Shadcn_,
+ Button,
+ Collapsible,
+ Form,
+ IconAlertTriangle,
+ Input,
+} from 'ui'
import { ProviderCollapsibleClasses } from './AuthProvidersForm.constants'
import type { Provider } from './AuthProvidersForm.types'
import FormField from './FormField'
@@ -155,6 +165,25 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {
border-strong bg-surface-100 py-6 px-6 text-foreground
"
>
+ {provider.title === 'Slack (Deprecated)' && (
+ <Alert_Shadcn_ variant="warning">
+ <IconAlertTriangle strokeWidth={2} />
+ <AlertTitle_Shadcn_>Slack (Deprecated) Provider</AlertTitle_Shadcn_>
+ <AlertDescription_Shadcn_>
+ Recently, Slack has updated their OAuth API. Please use the new Slack (OIDC)
+ provider below. Developers using this provider should move over to the new
+ provider. Please refer to our{' '}
+ <a
+ href="https://supabase.com/docs/guides/auth/social-login/auth-slack"
+ className="underline"
+ target="_blank"
+ >
+ documentation
+ </a>{' '}
+ for more details.
+ </AlertDescription_Shadcn_>
+ </Alert_Shadcn_>
+ )}
<div className="mx-auto my-6 max-w-lg space-y-6">
{Object.keys(provider.properties).map((x: string) => (
<FormField
@@ -162,7 +191,11 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {
name={x}
properties={provider.properties[x]}
formValues={values}
- disabled={!canUpdateConfig}
+ disabled={
+ // TODO (KM): Remove after 10th October when we disable the provider
+ ['EXTERNAL_SLACK_CLIENT_ID', 'EXTERNAL_SLACK_SECRET'].includes(x) ||
+ !canUpdateConfig
+ }
/>
))}
diff --git a/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx
index 650933b6470..efe243e1b07 100644
--- a/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx
+++ b/apps/studio/components/interfaces/Auth/AuthProvidersFormValidation.tsx
@@ -1170,7 +1170,7 @@ const EXTERNAL_PROVIDER_TWITTER = {
const EXTERNAL_PROVIDER_SLACK = {
$schema: JSON_SCHEMA_VERSION,
type: 'object',
- title: 'Slack',
+ title: 'Slack (Deprecated)',
properties: {
EXTERNAL_SLACK_ENABLED: {
title: 'Slack enabled',
@@ -1205,6 +1205,44 @@ const EXTERNAL_PROVIDER_SLACK = {
},
}
+const EXTERNAL_PROVIDER_SLACK_OIDC = {
+ $schema: JSON_SCHEMA_VERSION,
+ type: 'object',
+ title: 'Slack (OIDC)',
+ properties: {
+ EXTERNAL_SLACK_OIDC_ENABLED: {
+ title: 'Slack enabled',
+ type: 'boolean',
+ },
+ EXTERNAL_SLACK_OIDC_CLIENT_ID: {
+ title: 'Client ID',
+ type: 'string',
+ },
+ EXTERNAL_SLACK_OIDC_SECRET: {
+ title: 'Client Secret',
+ type: 'string',
+ isSecret: true,
+ },
+ },
+ validationSchema: object().shape({
+ EXTERNAL_SLACK_OIDC_ENABLED: boolean().required(),
+ EXTERNAL_SLACK_OIDC_CLIENT_ID: string().when('EXTERNAL_SLACK_OIDC_ENABLED', {
+ is: true,
+ then: (schema) => schema.required('Client ID is required'),
+ otherwise: (schema) => schema,
+ }),
+ EXTERNAL_SLACK_OIDC_SECRET: string().when('EXTERNAL_SLACK_OIDC_ENABLED', {
+ is: true,
+ then: (schema) => schema.required('Client Secret is required'),
+ otherwise: (schema) => schema,
+ }),
+ }),
+ misc: {
+ iconKey: 'slack-icon',
+ requiresRedirect: true,
+ },
+}
+
const EXTERNAL_PROVIDER_SPOTIFY = {
$schema: JSON_SCHEMA_VERSION,
type: 'object',
@@ -1369,6 +1407,7 @@ export const PROVIDERS_SCHEMAS = [
EXTERNAL_PROVIDER_NOTION,
EXTERNAL_PROVIDER_TWITCH,
EXTERNAL_PROVIDER_TWITTER,
+ EXTERNAL_PROVIDER_SLACK_OIDC,
EXTERNAL_PROVIDER_SLACK,
EXTERNAL_PROVIDER_SPOTIFY,
EXTERNAL_PROVIDER_WORKOS,
diff --git a/apps/studio/pages/api/auth/[ref]/config.ts b/apps/studio/pages/api/auth/[ref]/config.ts
index 1faef0ce619..796a37165fc 100644
--- a/apps/studio/pages/api/auth/[ref]/config.ts
+++ b/apps/studio/pages/api/auth/[ref]/config.ts
@@ -99,9 +99,9 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
EXTERNAL_SPOTIFY_ENABLED: external?.spotify ?? false,
EXTERNAL_SPOTIFY_CLIENT_ID: null,
EXTERNAL_SPOTIFY_SECRET: null,
- EXTERNAL_SLACK_ENABLED: external?.slack ?? false,
- EXTERNAL_SLACK_CLIENT_ID: null,
- EXTERNAL_SLACK_SECRET: null,
+ EXTERNAL_SLACK_OIDC_ENABLED: external?.slack ?? false,
+ EXTERNAL_SLACK_OIDC_CLIENT_ID: null,
+ EXTERNAL_SLACK_OIDC_SECRET: null,
EXTERNAL_TWITTER_ENABLED: external?.twitter ?? false,
EXTERNAL_TWITTER_CLIENT_ID: null,
EXTERNAL_TWITTER_SECRET: null,