The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
feat: add LinkedIn OIDCProvider (#18225)
Joel Lee911d0a4d470a
diff --git a/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdx b/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdxindex 190c4738dae..035562957b2 100644--- a/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdx+++ b/apps/docs/pages/guides/auth/social-login/auth-linkedin.mdx@@ -11,15 +11,18 @@ To enable LinkedIn Auth for your project, you need to set up a LinkedIn OAuth ap## Overview<Admonition type="caution" label="update">--Linkedin has updated their [OAuth APIs](https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin%2Fcontext&tabs=HTTPS1), which has broken the current Supabase implementation. We're actively tracking [this issue](https://github.com/supabase/gotrue/issues/1216) and you can subscribe to it for future updates.-+ 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.</Admonition>Setting up LinkedIn logins for your application consists of 3 parts:- Create and configure a LinkedIn Project and App on the [LinkedIn Developer Dashboard](https://www.linkedin.com/developers/apps).-- Add your LinkedIn `client_id` and `client_secret` to your [Supabase Project](https://supabase.com/dashboard).+- Add your _LinkedIn (OIDC)_ `client_id` and `client_secret` to your [Supabase Project](https://supabase.com/dashboard).- Add the login code to your [Supabase JS Client App](https://github.com/supabase/supabase-js).## Access your LinkedIn Developer account@@ -39,14 +42,20 @@ Setting up LinkedIn logins for your application consists of 3 parts:- Click on `Create App` at the top right- Enter your `LinkedIn Page` and `App Logo`- Save your app+- Click `Products` from the top menu+- Look for `Sign In with LinkedIn using OpenID Connect` and click on Request Access- Click `Auth` from the top menu- Add your `Redirect URL` to the `Authorized Redirect URLs for your app` section- Copy and save your newly-generated `Client ID`- Copy and save your newly-generated `Client Secret`-## Enter your LinkedIn credentials into your Supabase Project+Ensure that the appropriate scopes have been added under OAuth 2.0 Scopes at the bottom of the `Auth` screen.++-<SocialProviderSettingsSupabase provider="LinkedIn" />+## Enter your LinkedIn (OIDC) credentials into your Supabase Project++<SocialProviderSettingsSupabase provider="LinkedIn (OIDC)" />## Add login code to your client app@@ -59,12 +68,12 @@ Setting up LinkedIn logins for your application consists of 3 parts:><TabPanel id="js" label="JavaScript">-When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `linkedin` as the `provider`:+When your user signs in, call [signInWithOAuth()](/docs/reference/javascript/auth-signinwithoauth) with `linkedin_oidc` as the `provider`:```jsasync function signInWithLinkedIn() {const { data, error } = await supabase.auth.signInWithOAuth({- provider: 'linkedin',+ provider: 'linkedin_oidc',})}```@@ -114,6 +123,19 @@ suspend fun signOut() {</TabPanel></Tabs>+## LinkedIn Open ID Connect (OIDC)++To support recent changes to the LinkedIn [OAuth APIs](https://learn.microsoft.com/en-us/linkedin/shared/authentication/authorization-code-flow?context=linkedin%2Fcontext&tabs=HTTPS1), we will be replacing the _LinkedIn_ provider with a new _LinkedIn (OIDC)_ provider which utilizes the [Open ID Connect standard](https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/sign-in-with-linkedin-v2#validating-id-tokens). Consequently, we have disabled edits on the _LinkedIn_ provider and will be removing it effective 30th November 2023. Developers with LinkedIn OAuth Applications created prior to 1st August 2023 should create a new OAuth application [via the steps outlined above](/docs/guides/auth/social-login/auth-linkedin#create-a-linkedin-oauth-app) and migrate their credentials from the _LinkedIn_ provider to the _LinkedIn (OIDC)_ provider. Developers using the Supabase CLI to test their LinkedIn OAuth application should also update their `config.toml` to make use of the new provider:++```+[auth.external.linkedin_oidc]+enabled = true+client_id = ...+secret = ...+```++Do reach out to support if you have any concerns around this change.+## Resources- [Supabase Account - Free Plan OK](https://supabase.com)diff --git a/apps/docs/public/img/guides/auth-linkedin/oauth-scopes.png b/apps/docs/public/img/guides/auth-linkedin/oauth-scopes.pngnew file mode 100644index 00000000000..27b057c2344Binary files /dev/null and b/apps/docs/public/img/guides/auth-linkedin/oauth-scopes.png differdiff --git a/apps/www/supabase/config.toml b/apps/www/supabase/config.tomlindex cc86c099e31..006983a0381 100644--- a/apps/www/supabase/config.toml+++ b/apps/www/supabase/config.toml@@ -53,7 +53,8 @@ double_confirm_changes = trueenable_confirmations = true# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,-# `discord`, `facebook`, `github`, `gitlab`, `google`, `twitch`, `twitter`, `slack`, `spotify`.+# `discord`, `facebook`, `figma`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `linkedin_oidc`, `notion`,+# `twitch`, `twitter`, `slack`, `spotify`, `workos`, `zoom`.[auth.external.apple]enabled = falseclient_id = ""diff --git a/studio/components/interfaces/Auth/Auth.types.ts b/studio/components/interfaces/Auth/Auth.types.tsindex 49973dde46b..c08e8a71a5d 100644--- a/studio/components/interfaces/Auth/Auth.types.ts+++ b/studio/components/interfaces/Auth/Auth.types.ts@@ -56,6 +56,10 @@ export interface AuthConfig {EXTERNAL_LINKEDIN_CLIENT_ID: string | nullEXTERNAL_LINKEDIN_SECRET: string | null+ EXTERNAL_LINKEDIN_OIDC_ENABLED: boolean+ EXTERNAL_LINKEDIN_OIDC_CLIENT_ID: string | null+ EXTERNAL_LINKEDIN_OIDC_SECRET: string | null+EXTERNAL_NOTION_ENABLED: booleanEXTERNAL_NOTION_CLIENT_ID: string | nullEXTERNAL_NOTION_SECRET: string | nulldiff --git a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsxindex 4a3ae20adbf..ff426b37d9e 100644--- a/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx+++ b/studio/components/interfaces/Auth/AuthProvidersForm/ProviderForm.tsx@@ -57,11 +57,18 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {return initialValues}+ const isSAMLEnabled: boolean =+ provider.title === 'SAML 2.0' && config && (config as any)['SAML_ENABLED']+ // [Joel] Introduced as the new LinkedIn provider has a corresponding config var of LINKEDIN_OIDC+ const isLinkedInOIDCEnabled: boolean =+ provider.title === 'LinkedIn (OIDC)' &&+ config &&+ (config as any)['EXTERNAL_LINKEDIN_OIDC_ENABLED']+ const isExternalProviderAndEnabled: boolean =+ config && (config as any)[`EXTERNAL_${provider?.title?.toUpperCase()}_ENABLED`]+// [Joshen] Doing this check as SAML doesn't follow the same naming structure as the other provider options- const isActive: boolean =- provider.title === 'SAML 2.0'- ? (config && (config as any)['SAML_ENABLED']) ?? false- : (config && (config as any)[`EXTERNAL_${provider?.title?.toUpperCase()}_ENABLED`]) ?? false+ const isActive: boolean = isSAMLEnabled || isExternalProviderAndEnabled || isLinkedInOIDCEnabledconst INITIAL_VALUES = generateInitialValues()const onSubmit = (values: any, { resetForm }: any) => {@@ -139,39 +146,45 @@ const ProviderForm = ({ config, provider }: ProviderFormProps) => {<Collapsible.Content><divclassName="- group border-t- border-scale-500 bg-scale-100 py-6 px-6 text-foreground dark:bg-scale-300- "+ group border-t+ border-scale-500 bg-scale-100 py-6 px-6 text-foreground dark:bg-scale-300+ "><div className="mx-auto my-6 max-w-lg space-y-6">- {provider.title === 'LinkedIn' && (+ {provider.title === 'LinkedIn (Deprecated)' && (<Alert_Shadcn_ variant="warning"><IconAlertTriangle strokeWidth={2} />- <AlertTitle_Shadcn_>- LinkedIn provider temporarily unavailable- </AlertTitle_Shadcn_>+ <AlertTitle_Shadcn_>LinkedIn (Deprecated) Provider</AlertTitle_Shadcn_><AlertDescription_Shadcn_>- Linkedin has updated their OAuth APIs, which has broken the current Supabase- implementation. We're actively tracking{' '}- <a- className="underline"- href="https://github.com/supabase/gotrue/issues/1216"- >- this issue- </a>{' '}- and you can subscribe to it for future updates.+ As of 1st August, LinkedIn has updated their OAuth API scopes. Please use+ the 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.</AlertDescription_Shadcn_></Alert_Shadcn_>)}- {Object.keys(provider.properties).map((x: string) => (- <FormField- key={x}- name={x}- properties={provider.properties[x]}- formValues={values}- disabled={!canUpdateConfig}- />- ))}+ {/* 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}+ />+ ))}{provider?.misc?.alert && (<Alert title={provider.misc.alert.title} variant="warning" withIcon><ReactMarkdown>{provider.misc.alert.description}</ReactMarkdown>diff --git a/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx b/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsxindex 970437a8b93..7bd1b49426c 100644--- a/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx+++ b/studio/stores/authConfig/schema/AuthProviders/AuthProvidersFormValidation.tsx@@ -1004,10 +1004,10 @@ const EXTERNAL_PROVIDER_KEYCLOAK = {const EXTERNAL_PROVIDER_LINKEDIN = {$schema: JSON_SCHEMA_VERSION,type: 'object',- title: 'LinkedIn',+ title: 'LinkedIn (Deprecated)',properties: {EXTERNAL_LINKEDIN_ENABLED: {- title: 'Linkedin enabled',+ title: 'Linkedin (Deprecated) enabled',type: 'boolean',},// [TODO] Update docs@@ -1041,6 +1041,44 @@ const EXTERNAL_PROVIDER_LINKEDIN = {},}+const EXTERNAL_PROVIDER_LINKEDIN_OIDC = {+ $schema: JSON_SCHEMA_VERSION,+ type: 'object',+ title: 'LinkedIn (OIDC)',+ properties: {+ EXTERNAL_LINKEDIN_OIDC_ENABLED: {+ title: 'LinkedIn enabled',+ type: 'boolean',+ },+ EXTERNAL_LINKEDIN_OIDC_CLIENT_ID: {+ title: 'API Key',+ type: 'string',+ },+ EXTERNAL_LINKEDIN_OIDC_SECRET: {+ title: 'API Secret Key',+ type: 'string',+ isSecret: true,+ },+ },+ validationSchema: object().shape({+ EXTERNAL_LINKEDIN_OIDC_ENABLED: boolean().required(),+ EXTERNAL_LINKEDIN_OIDC_CLIENT_ID: string().when('EXTERNAL_LINKEDIN_OIDC_ENABLED', {+ is: true,+ then: (schema) => schema.required('API Key is required'),+ otherwise: (schema) => schema,+ }),+ EXTERNAL_LINKEDIN_OIDC_SECRET: string().when('EXTERNAL_LINKEDIN_OIDC_ENABLED', {+ is: true,+ then: (schema) => schema.required('API Secret Key is required'),+ otherwise: (schema) => schema,+ }),+ }),+ misc: {+ iconKey: 'linkedin-icon',+ requiresRedirect: true,+ },+}+const EXTERNAL_PROVIDER_NOTION = {$schema: JSON_SCHEMA_VERSION,type: 'object',@@ -1354,6 +1392,7 @@ export const PROVIDERS_SCHEMAS = [EXTERNAL_PROVIDER_KAKAO,EXTERNAL_PROVIDER_KEYCLOAK,EXTERNAL_PROVIDER_LINKEDIN,+ EXTERNAL_PROVIDER_LINKEDIN_OIDC,EXTERNAL_PROVIDER_NOTION,EXTERNAL_PROVIDER_TWITCH,EXTERNAL_PROVIDER_TWITTER,diff --git a/studio/stores/jsonSchema/auth_gotrue_config.json b/studio/stores/jsonSchema/auth_gotrue_config.jsonindex 3269fee55dd..be225ef5c2f 100644--- a/studio/stores/jsonSchema/auth_gotrue_config.json+++ b/studio/stores/jsonSchema/auth_gotrue_config.json@@ -249,6 +249,18 @@"title": "Linkedin secret","type": "string"},+ "EXTERNAL_LINKEDIN_OIDC_ENABLED": {+ "title": "LinkedIn enabled",+ "type": "boolean"+ },+ "EXTERNAL_LINKEDIN_OIDC_CLIENT_ID": {+ "title": "LinkedIn client ID",+ "type": "string"+ },+ "EXTERNAL_LINKEDIN_OIDC_SECRET": {+ "title": "LinkedIn secret",+ "type": "string"+ },"EXTERNAL_NOTION_ENABLED": {"title": "Notion enabled","type": "boolean"diff --git a/supabase/config.toml b/supabase/config.tomlindex f0c3d816b66..876e8a4c2da 100644--- a/supabase/config.toml+++ b/supabase/config.toml@@ -59,7 +59,7 @@ double_confirm_changes = trueenable_confirmations = false# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,-# `discord`, `facebook`, `figma`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `notion`,+# `discord`, `facebook`, `figma`, `github`, `gitlab`, `google`, `keycloak`, `linkedin`, `linkedin_oidc`, `notion`,# `twitch`, `twitter`, `slack`, `spotify`, `workos`, `zoom`.[auth.external.apple]enabled = false