The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add identity linking config (#19615)
Kang Minge9a6a40625ce
diff --git a/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdx b/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdxindex e90289ec3d5..f1d0d61e43b 100644--- a/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdx+++ b/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdx@@ -10,7 +10,7 @@ To enable LinkedIn Auth for your project, you need to set up a LinkedIn OAuth ap## Overview-<Admonition type="caution" label="update">+<Admonition type="caution">We will be replacing the existing _LinkedIn_ provider with a new _LinkedIn (OIDC)_ provider. Developers with LinkedIn OAuth Applications created prior to 1st August 2023 should create a new OAuth application and migrate their credentials from the _LinkedIn_ provider to the _LinkedIn (OIDC)_ provider. [Read this section](/docs/guides/auth/social-login/auth-linkedin#linkedin-open-id-connect-oidc) to find out more.diff --git a/apps/docs/pages/guides/auth/social-login/auth-slack.mdx b/apps/docs/pages/guides/auth/social-login/auth-slack.mdxindex fcb7b2b01aa..596fb43f07c 100644--- a/apps/docs/pages/guides/auth/social-login/auth-slack.mdx+++ b/apps/docs/pages/guides/auth/social-login/auth-slack.mdx@@ -10,7 +10,7 @@ To enable Slack Auth for your project, you need to set up a Slack OAuth applicat## Overview-<Admonition type="caution" label="update">+<Admonition type="caution">The Slack OAuth provider supported by Supabase uses Slack's [**Legacy OAuth API**](https://api.slack.com/legacy/oauth). If you created an OAuth app on Slack recently, some of the scopes specified may not work with the Slack OAuth provider on Supabase. You can refer to the [**list of supported scopes**](https://api.slack.com/scopes) for the legacy OAuth app and this [**github issue**](https://github.com/supabase/gotrue/issues/1294) for future updates.diff --git a/apps/studio/components/interfaces/Auth/Auth.types.ts b/apps/studio/components/interfaces/Auth/Auth.types.tsindex a7e7f50a5b9..5e0ba423098 100644--- a/apps/studio/components/interfaces/Auth/Auth.types.ts+++ b/apps/studio/components/interfaces/Auth/Auth.types.ts@@ -6,6 +6,7 @@ export interface AuthConfig {updated_at: stringDISABLE_SIGNUP: boolean+ SECURITY_MANUAL_LINKING_ENABLED: booleanEXTERNAL_EMAIL_ENABLED: booleanEXTERNAL_PHONE_ENABLED: booleandiff --git a/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsxindex e2c98986c57..da59b87c124 100644--- a/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx+++ b/apps/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx@@ -41,7 +41,6 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {const canUpdateConfig = useCheckPermissions(PermissionAction.UPDATE, 'custom_config_gotrue')const { data: customDomainData } = useCustomDomainsQuery({ projectRef })-const generateInitialValues = () => {const initialValues: { [x: string]: string | boolean } = {}@@ -170,34 +169,32 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {<AlertDescription_Shadcn_>As of 1st August, LinkedIn has updated their OAuth API scopes. Please usethe new LinkedIn provider below. Developers using this provider should move- over to the new provider. Please refer to our- [docs](/docs/pages/guides/auth/social-login/auth-linkedin) for more details.+ over to the new provider. Please refer to our{' '}+ <a+ href="https://supabase.com/docs/guides/auth/social-login/auth-linkedin"+ className="underline"+ target="_blank"+ >+ documentation+ </a>{' '}+ for more details.</AlertDescription_Shadcn_></Alert_Shadcn_>)}- {/* TODO (Joel): Remove after 30th November when we disable the provider */}- {provider.title === 'LinkedIn (Deprecated)' &&- Object.keys(provider.properties).map((x: string) => (- <FormField- key={x}- name={x}- properties={provider.properties[x]}- formValues={values}- disabled={x === 'EXTERNAL_LINKEDIN_ENABLED' ? !canUpdateConfig : true}- />- ))}-- {provider.title !== 'LinkedIn (Deprecated)' &&- Object.keys(provider.properties).map((x: string) => (- <FormField- key={x}- name={x}- properties={provider.properties[x]}- formValues={values}- disabled={!canUpdateConfig}- />- ))}+ {Object.keys(provider.properties).map((x: string) => (+ <FormField+ key={x}+ name={x}+ properties={provider.properties[x]}+ formValues={values}+ // TODO (Joel): Remove after 30th November when we disable the provider+ disabled={+ ['EXTERNAL_LINKEDIN_CLIENT_ID', 'EXTERNAL_LINKEDIN_SECRET'].includes(x) ||+ !canUpdateConfig+ }+ />+ ))}{provider?.misc?.alert && (<Alert title={provider.misc.alert.title} variant="warning" withIcon>diff --git a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsxindex 271871dfe77..e0dd091a3e1 100644--- a/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx+++ b/apps/studio/components/interfaces/Auth/BasicAuthSettingsForm/BasicAuthSettingsForm.tsx@@ -32,6 +32,7 @@ import { useAuthConfigQuery } from 'data/auth/auth-config-query'import { useAuthConfigUpdateMutation } from 'data/auth/auth-config-update-mutation'import { useOrgSubscriptionQuery } from 'data/subscriptions/org-subscription-query'import { useCheckPermissions, useFlag, useSelectedOrganization, useStore } from 'hooks'+import { Markdown } from 'components/interfaces/Markdown'// Use a const string to represent no chars option. Represented as empty string on the backend side.const NO_REQUIRED_CHARACTERS = 'NO_REQUIRED_CHARS'@@ -41,6 +42,7 @@ const LOWER_UPPER_DIGITS_SYMBOLS = LOWER_UPPER_DIGITS + ':!@#$%^&*()_+-=[]{};\'\const schema = object({DISABLE_SIGNUP: boolean().required(),+ SECURITY_MANUAL_LINKING_ENABLED: boolean().required(),SITE_URL: string().required('Must have a Site URL'),SECURITY_CAPTCHA_ENABLED: boolean().required(),SECURITY_CAPTCHA_SECRET: string().when('SECURITY_CAPTCHA_ENABLED', {@@ -100,6 +102,7 @@ const BasicAuthSettingsForm = observer(() => {const INITIAL_VALUES = {DISABLE_SIGNUP: !authConfig?.DISABLE_SIGNUP,+ SECURITY_MANUAL_LINKING_ENABLED: authConfig?.SECURITY_MANUAL_LINKING_ENABLED || false,SITE_URL: authConfig?.SITE_URL,SECURITY_CAPTCHA_ENABLED: authConfig?.SECURITY_CAPTCHA_ENABLED || false,SECURITY_CAPTCHA_SECRET: authConfig?.SECURITY_CAPTCHA_SECRET || '',@@ -210,6 +213,20 @@ const BasicAuthSettingsForm = observer(() => {descriptionText="If this is disabled, new users will not be able to sign up to your application."disabled={!canUpdateConfig}/>+ <Toggle+ id="SECURITY_MANUAL_LINKING_ENABLED"+ size="small"+ label="Allow manual linking"+ layout="flex"+ descriptionText={+ <Markdown+ extLinks+ className="[&>p>a]:text-foreground-light [&>p>a]:transition-all [&>p>a]:hover:text-foreground [&>p>a]:hover:decoration-brand"+ content="Enable [manual linking APIs](https://supabase.com/docs/guides/auth/auth-identity-linking#manual-linking-beta) for your project."+ />+ }+ disabled={!canUpdateConfig}+ /></FormSectionContent></FormSection>{passwordStrengthReleased && (diff --git a/apps/studio/components/interfaces/Markdown.tsx b/apps/studio/components/interfaces/Markdown.tsxindex baed3111240..a5326154fb2 100644--- a/apps/studio/components/interfaces/Markdown.tsx+++ b/apps/studio/components/interfaces/Markdown.tsx@@ -5,12 +5,20 @@ import { cn } from 'ui'interface Props extends Omit<ReactMarkdownProps, 'children' | 'node'> {className?: stringcontent: string+ extLinks?: boolean}-const Markdown = ({ className, content = '', ...props }: Props) => {+const Markdown = ({ className, content = '', extLinks = false, ...props }: Props) => {return (<ReactMarkdown- components={{ h3: ({ children }) => <h3 className="mb-1">{children}</h3> }}+ components={{+ h3: ({ children }) => <h3 className="mb-1">{children}</h3>,+ a: ({ href, children }) => (+ <a href={href} target={extLinks ? '_blank' : ''} rel={extLinks ? 'noreferrer' : ''}>+ {children}+ </a>+ ),+ }}{...props}className={cn('prose text-sm', className)}>diff --git a/apps/studio/pages/api/auth/[ref]/config.ts b/apps/studio/pages/api/auth/[ref]/config.tsindex 060a6b3249e..7b214e82c1f 100644--- a/apps/studio/pages/api/auth/[ref]/config.ts+++ b/apps/studio/pages/api/auth/[ref]/config.ts@@ -147,6 +147,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {SECURITY_CAPTCHA_ENABLED: false,SECURITY_CAPTCHA_PROVIDER: 'hcaptcha',SECURITY_CAPTCHA_SECRET: null,+ SECURITY_MANUAL_LINKING_ENABLED: false,SECURITY_REFRESH_TOKEN_REUSE_INTERVAL: '10',RATE_LIMIT_EMAIL_SENT: 0,RATE_LIMIT_SMS_SENT: 0,diff --git a/apps/studio/stores/jsonSchema/auth_gotrue_config.json b/apps/studio/stores/jsonSchema/auth_gotrue_config.jsonindex be225ef5c2f..b983b8c4fc8 100644--- a/apps/studio/stores/jsonSchema/auth_gotrue_config.json+++ b/apps/studio/stores/jsonSchema/auth_gotrue_config.json@@ -3,6 +3,7 @@"required": ["SITE_URL","DISABLE_SIGNUP",+ "SECURITY_MANUAL_LINKING_ENABLED","JWT_EXP","JWT_AUD","JWT_DEFAULT_GROUP_NAME",@@ -64,7 +65,12 @@"DISABLE_SIGNUP": {"title": "Disable signup","type": "boolean",- "help": "Allow/disallow new user signups to your project."+ "help": "Allow/disallow new user signups for your project."+ },+ "SECURITY_MANUAL_LINKING_ENABLED": {+ "title": "Enable Manual Linking",+ "type": "boolean",+ "help": "Enable manual linking APIs for your project"},"EXTERNAL_EMAIL_ENABLED": {"title": "Enable email signup",