Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/backend/src/oauth/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { GoogleProvider } from "./providers/google";
import { LinkedInProvider } from "./providers/linkedin";
import { MicrosoftProvider } from "./providers/microsoft";
import { MockProvider } from "./providers/mock";
import { OktaProvider } from "./providers/okta";
import { SpotifyProvider } from "./providers/spotify";
import { TwitchProvider } from "./providers/twitch";
import { XProvider } from "./providers/x";
Expand All @@ -31,6 +32,7 @@ const _providers = {
linkedin: LinkedInProvider,
x: XProvider,
twitch: TwitchProvider,
okta:OktaProvider,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing space after colon

Suggested change
okta:OktaProvider,
okta: OktaProvider,
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/backend/src/oauth/index.tsx
Line: 35:35

Comment:
**style:** missing space after colon

```suggestion
  okta: OktaProvider,
```

How can I resolve this? If you propose a fix, please make it concise.

} as const;

const mockProvider = MockProvider;
Expand Down Expand Up @@ -78,6 +80,7 @@ export async function getProvider(provider: Tenancy['config']['auth']['oauth']['
clientSecret: provider.clientSecret || throwErr("Client secret is required for standard providers"),
facebookConfigId: provider.facebookConfigId,
microsoftTenantId: provider.microsoftTenantId,
oktaDomain:provider.oktaDomain,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing space after colon

Suggested change
oktaDomain:provider.oktaDomain,
oktaDomain: provider.oktaDomain,
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/backend/src/oauth/index.tsx
Line: 83:83

Comment:
**style:** missing space after colon

```suggestion
      oktaDomain: provider.oktaDomain,
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The OktaProvider.create() method expects a parameter named okta_issuer, but the code is passing oktaDomain. This will cause the provider to fail with "Okta domain is required" at runtime.

View Details
📝 Patch Details
diff --git a/apps/backend/src/app/api/latest/integrations/neon/oauth-providers/crud.tsx b/apps/backend/src/app/api/latest/integrations/neon/oauth-providers/crud.tsx
index 858018bc..73498f06 100644
--- a/apps/backend/src/app/api/latest/integrations/neon/oauth-providers/crud.tsx
+++ b/apps/backend/src/app/api/latest/integrations/neon/oauth-providers/crud.tsx
@@ -22,6 +22,7 @@ const oauthProviderReadSchema = yupObject({
   // extra params
   facebook_config_id: schemaFields.oauthFacebookConfigIdSchema.optional(),
   microsoft_tenant_id: schemaFields.oauthMicrosoftTenantIdSchema.optional(),
+  okta_issuer: schemaFields.oauthOktaIssuerSchema.optional(),
 });
 
 const oauthProviderUpdateSchema = yupObject({
@@ -38,6 +39,7 @@ const oauthProviderUpdateSchema = yupObject({
   // extra params
   facebook_config_id: schemaFields.oauthFacebookConfigIdSchema.optional(),
   microsoft_tenant_id: schemaFields.oauthMicrosoftTenantIdSchema.optional(),
+  okta_issuer: schemaFields.oauthOktaIssuerSchema.optional(),
 });
 
 const oauthProviderCreateSchema = oauthProviderUpdateSchema.defined().concat(yupObject({
@@ -77,6 +79,7 @@ function oauthProviderConfigToLegacyConfig(provider: Tenancy['config']['auth']['
     client_secret: provider.clientSecret,
     facebook_config_id: provider.facebookConfigId,
     microsoft_tenant_id: provider.microsoftTenantId,
+    okta_issuer: provider.oktaIssuer,
   } as const;
 }
 
diff --git a/apps/backend/src/lib/config.tsx b/apps/backend/src/lib/config.tsx
index 0838f3d4..d3480cac 100644
--- a/apps/backend/src/lib/config.tsx
+++ b/apps/backend/src/lib/config.tsx
@@ -518,6 +518,7 @@ export const renderedOrganizationConfigToProjectCrud = (renderedConfig: Complete
         client_secret: oauthProvider.clientSecret,
         facebook_config_id: oauthProvider.facebookConfigId,
         microsoft_tenant_id: oauthProvider.microsoftTenantId,
+        okta_issuer: oauthProvider.oktaIssuer,
       } as const) satisfies ProjectsCrud["Admin"]["Read"]['config']['oauth_providers'][number];
     })
     .filter(isTruthy)
diff --git a/apps/backend/src/lib/projects.tsx b/apps/backend/src/lib/projects.tsx
index 713ac097..d698d913 100644
--- a/apps/backend/src/lib/projects.tsx
+++ b/apps/backend/src/lib/projects.tsx
@@ -188,6 +188,7 @@ export async function createOrUpdateProjectWithLegacyConfig(
             clientSecret: provider.client_secret,
             facebookConfigId: provider.facebook_config_id,
             microsoftTenantId: provider.microsoft_tenant_id,
+            oktaIssuer: provider.okta_issuer,
             allowSignIn: true,
             allowConnectedAccounts: true,
           } satisfies CompleteConfig['auth']['oauth']['providers'][string]
diff --git a/apps/backend/src/oauth/index.tsx b/apps/backend/src/oauth/index.tsx
index 616a0a7c..ac20ca53 100644
--- a/apps/backend/src/oauth/index.tsx
+++ b/apps/backend/src/oauth/index.tsx
@@ -80,7 +80,7 @@ export async function getProvider(provider: Tenancy['config']['auth']['oauth']['
       clientSecret: provider.clientSecret || throwErr("Client secret is required for standard providers"),
       facebookConfigId: provider.facebookConfigId,
       microsoftTenantId: provider.microsoftTenantId,
-      oktaDomain:provider.oktaDomain,
+      okta_issuer: provider.oktaIssuer,
     });
   }
 }
diff --git a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
index 7e262d36..e2f3afe4 100644
--- a/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
+++ b/apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
@@ -64,7 +64,7 @@ export const providerFormSchema = yupObject({
     }),
   facebookConfigId: yupString().optional(),
   microsoftTenantId: yupString().optional(),
-  oktaDomain:yupString().optional()
+  oktaIssuer:yupString().optional()
 });
 
 export type ProviderFormValues = yup.InferType<typeof providerFormSchema>
@@ -77,7 +77,7 @@ export function ProviderSettingDialog(props: Props & { open: boolean, onClose: (
     clientSecret: (props.provider as any)?.clientSecret ?? "",
     facebookConfigId: (props.provider as any)?.facebookConfigId ?? "",
     microsoftTenantId: (props.provider as any)?.microsoftTenantId ?? "",
-    oktaDomain:(props.provider as any)?.oktaDomain??"",
+    oktaIssuer:(props.provider as any)?.oktaIssuer??"",
   };
 
   const onSubmit = async (values: ProviderFormValues) => {
@@ -91,7 +91,7 @@ export function ProviderSettingDialog(props: Props & { open: boolean, onClose: (
         clientSecret: values.clientSecret || "",
         facebookConfigId: values.facebookConfigId,
         microsoftTenantId: values.microsoftTenantId,
-        oktaDomain:values.oktaDomain,
+        oktaIssuer:values.oktaIssuer,
       });
     }
   };
@@ -171,12 +171,12 @@ export function ProviderSettingDialog(props: Props & { open: boolean, onClose: (
                 />
               )}
 
-              {props.id === 'Okta' && (
+              {props.id === 'okta' && (
                 <InputField
                   control={form.control}
-                  name="oktaDomain"
-                  label="Okta Domain (required if you are using Okta)"
-                  placeholder="oktaDomain"
+                  name="oktaIssuer"
+                  label="Okta Issuer URL (required if you are using Okta)"
+                  placeholder="https://your-domain.okta.com"
                 />
               )}
             </>
diff --git a/packages/stack-shared/src/config/schema-fuzzer.test.ts b/packages/stack-shared/src/config/schema-fuzzer.test.ts
index 36475954..dded169c 100644
--- a/packages/stack-shared/src/config/schema-fuzzer.test.ts
+++ b/packages/stack-shared/src/config/schema-fuzzer.test.ts
@@ -180,6 +180,7 @@ const environmentSchemaFuzzerConfig = [{
         clientSecret: ["some-client-secret"],
         facebookConfigId: ["some-facebook-config-id"],
         microsoftTenantId: ["some-microsoft-tenant-id"],
+        oktaIssuer: ["https://example.okta.com"],
       }]]))] as const,
     }],
   }],
diff --git a/packages/stack-shared/src/config/schema.ts b/packages/stack-shared/src/config/schema.ts
index 8835d595..73a55947 100644
--- a/packages/stack-shared/src/config/schema.ts
+++ b/packages/stack-shared/src/config/schema.ts
@@ -223,6 +223,7 @@ export const environmentConfigSchema = branchConfigSchema.concat(yupObject({
           clientSecret: schemaFields.oauthClientSecretSchema.optional(),
           facebookConfigId: schemaFields.oauthFacebookConfigIdSchema.optional(),
           microsoftTenantId: schemaFields.oauthMicrosoftTenantIdSchema.optional(),
+          oktaIssuer: schemaFields.oauthOktaIssuerSchema.optional(),
           allowSignIn: yupBoolean().optional(),
           allowConnectedAccounts: yupBoolean().optional(),
         }),
@@ -507,6 +508,7 @@ const organizationConfigDefaults = {
         clientSecret: undefined,
         facebookConfigId: undefined,
         microsoftTenantId: undefined,
+        oktaIssuer: undefined,
       }),
     },
   },
diff --git a/packages/stack-shared/src/interface/crud/projects.ts b/packages/stack-shared/src/interface/crud/projects.ts
index b37713c2..45264e2e 100644
--- a/packages/stack-shared/src/interface/crud/projects.ts
+++ b/packages/stack-shared/src/interface/crud/projects.ts
@@ -22,6 +22,7 @@ const oauthProviderReadSchema = yupObject({
   // extra params
   facebook_config_id: schemaFields.oauthFacebookConfigIdSchema.optional(),
   microsoft_tenant_id: schemaFields.oauthMicrosoftTenantIdSchema.optional(),
+  okta_issuer: schemaFields.oauthOktaIssuerSchema.optional(),
 });
 
 const oauthProviderWriteSchema = oauthProviderReadSchema.omit(['provider_config_id']);
diff --git a/packages/stack-shared/src/schema-fields.ts b/packages/stack-shared/src/schema-fields.ts
index ca6f9c22..1e3e682f 100644
--- a/packages/stack-shared/src/schema-fields.ts
+++ b/packages/stack-shared/src/schema-fields.ts
@@ -527,6 +527,7 @@ export const oauthClientIdSchema = yupString().meta({ openapiField: { descriptio
 export const oauthClientSecretSchema = yupString().meta({ openapiField: { description: 'OAuth client secret. Needs to be specified when using type="standard"', exampleValue: 'google-oauth-client-secret' } });
 export const oauthFacebookConfigIdSchema = yupString().meta({ openapiField: { description: 'The configuration id for Facebook business login (for things like ads and marketing). This is only required if you are using the standard OAuth with Facebook and you are using Facebook business login.' } });
 export const oauthMicrosoftTenantIdSchema = yupString().meta({ openapiField: { description: 'The Microsoft tenant id for Microsoft directory. This is only required if you are using the standard OAuth with Microsoft and you have an Azure AD tenant.' } });
+export const oauthOktaIssuerSchema = yupString().meta({ openapiField: { description: 'The Okta issuer URL. This is required if you are using the standard OAuth with Okta.' } });
 export const oauthAccountMergeStrategySchema = yupString().oneOf(['link_method', 'raise_error', 'allow_duplicates']).meta({ openapiField: { description: 'Determines how to handle OAuth logins that match an existing user by email. `link_method` adds the OAuth method to the existing user. `raise_error` rejects the login with an error. `allow_duplicates` creates a new user.', exampleValue: 'link_method' } });
 // Project email config
 export const emailTypeSchema = yupString().oneOf(['shared', 'standard']).meta({ openapiField: { description: 'Email provider type, one of shared, standard. "shared" uses Stack shared email provider and it is only meant for development. "standard" uses your own email server and will have your email address as the sender.', exampleValue: 'standard' } });

Analysis

Okta OAuth Provider Configuration Missing Required Field

What fails: OktaProvider.create() expects an okta_issuer parameter, but the configuration schema and getProvider() function in apps/backend/src/oauth/index.tsx line 83 had no mechanism to pass this required parameter, causing Okta OAuth provider initialization to fail with "Okta domain is required" error at runtime.

How to reproduce:

  1. Configure an Okta OAuth provider with type: 'okta' in project config
  2. Set clientId, clientSecret, and the Okta issuer URL
  3. Attempt to use Okta authentication in the application
  4. Runtime error: StackAssertionError("Okta domain is required ")

Result: The Okta provider fails initialization because options.okta_issuer is undefined, causing the validation check at apps/backend/src/oauth/providers/okta.tsx:25 to throw an error.

Expected: Okta provider should receive the configured issuer URL and properly initialize the OAuth flow.

Fix:

  • Added oktaIssuer field to the OAuth provider configuration schema
  • Added corresponding schema field oauthOktaIssuerSchema in schema-fields.ts
  • Updated getProvider() to pass ok ta_issuer: provider.oktaIssuer to OktaProvider.create()
  • Updated config conversion functions to map between snake_case (okta_issuer) and camelCase (oktaIssuer)
  • Updated CRUD interface and fuzzer tests to include the new field

});
}
}
Expand Down
79 changes: 79 additions & 0 deletions apps/backend/src/oauth/providers/okta.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { getEnvVariable } from "@stackframe/stack-shared/dist/utils/env";
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";
import { getJwtInfo } from "@stackframe/stack-shared/dist/utils/jwt";
import { OAuthUserInfo, validateUserInfo } from "../utils";
import { OAuthBaseProvider, TokenSet } from "./base";


export class OktaProvider extends OAuthBaseProvider {
private oktaDomain : string;
private constructor(
oktaDomain: string,
...args: ConstructorParameters<typeof OAuthBaseProvider>
) {
super(...args);
this.oktaDomain = oktaDomain
}

static async create(options: {
clientId: string;
clientSecret: string;
okta_issuer: string;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: parameter name mismatch - receives oktaDomain from oauth/index.tsx:83 but expects okta_issuer

Suggested change
okta_issuer: string;
oktaDomain: string;
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/backend/src/oauth/providers/okta.tsx
Line: 21:21

Comment:
**logic:** parameter name mismatch - receives `oktaDomain` from `oauth/index.tsx:83` but expects `okta_issuer`

```suggestion
    oktaDomain: string;
```

How can I resolve this? If you propose a fix, please make it concise.

}) {
const oktaDomain = options.okta_issuer;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: reading from wrong parameter name - should be options.oktaDomain

Suggested change
const oktaDomain = options.okta_issuer;
const oktaDomain = options.oktaDomain;
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/backend/src/oauth/providers/okta.tsx
Line: 23:23

Comment:
**logic:** reading from wrong parameter name - should be `options.oktaDomain`

```suggestion
    const  oktaDomain  = options.oktaDomain;
```

How can I resolve this? If you propose a fix, please make it concise.


if(!oktaDomain) throw new StackAssertionError("Okta domain is required ")

return new OktaProvider(
oktaDomain,
...await OAuthBaseProvider.createConstructorArgs({
issuer: `https://${oktaDomain}`,
authorizationEndpoint: `${oktaDomain}/v1/authorize`,
tokenEndpoint: `${oktaDomain}/v1/token`,
redirectUri: getEnvVariable("OAUTH_REDIRECT_URI")!,
jwksUri: `${oktaDomain}/v1/keys`,
Comment thread
vercel[bot] marked this conversation as resolved.
Outdated
baseScope: "openid email profile",
authorizationExtraParams: { response_mode: "form_post" },
tokenEndpointAuthMethod: "client_secret_basic",
...options,
}))
;
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.

async postProcessUserInfo(tokenSet: TokenSet): Promise<OAuthUserInfo> {
const rawUserInfoRes = await fetch(`${this.oktaDomain}/v1/userinfo`, {
headers: {
Authorization: `Bearer ${tokenSet.accessToken}`,
},
});

if (!rawUserInfoRes.ok) {
throw new StackAssertionError(
"Error fetching user information from Okta",
{
status: rawUserInfoRes.status,
body: await rawUserInfoRes.text(),
jwtInfo: await getJwtInfo({ jwt: tokenSet.accessToken }),
}
);
}

const rawUserInfo = await rawUserInfoRes.json();

return validateUserInfo({
accountId: rawUserInfo.sub,
displayName: rawUserInfo.name,
profileImageUrl: rawUserInfo.picture,
email: rawUserInfo.email,
emailVerified: rawUserInfo.email_verified,
});
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
async checkAccessTokenValidity(accessToken: string): Promise<boolean> {
const res = await fetch(`${this.oktaDomain}/v1/userinfo`, {
headers: {
Authorization: `Bearer ${accessToken}`,
},
});
return res.ok;
}
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ function toTitle(id: string) {
linkedin: "LinkedIn",
twitch: "Twitch",
x: "X",
okta:"Okta"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing space after colon

Suggested change
okta:"Okta"
okta: "Okta"
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
Line: 47:47

Comment:
**style:** missing space after colon

```suggestion
    okta: "Okta"
```

How can I resolve this? If you propose a fix, please make it concise.

}[id];
}

Expand All @@ -63,6 +64,7 @@ export const providerFormSchema = yupObject({
}),
facebookConfigId: yupString().optional(),
microsoftTenantId: yupString().optional(),
oktaDomain:yupString().optional()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing space after colon

Suggested change
oktaDomain:yupString().optional()
oktaDomain: yupString().optional()
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
Line: 67:67

Comment:
**style:** missing space after colon

```suggestion
  oktaDomain: yupString().optional()
```

How can I resolve this? If you propose a fix, please make it concise.

});

export type ProviderFormValues = yup.InferType<typeof providerFormSchema>
Expand All @@ -75,6 +77,7 @@ export function ProviderSettingDialog(props: Props & { open: boolean, onClose: (
clientSecret: (props.provider as any)?.clientSecret ?? "",
facebookConfigId: (props.provider as any)?.facebookConfigId ?? "",
microsoftTenantId: (props.provider as any)?.microsoftTenantId ?? "",
oktaDomain:(props.provider as any)?.oktaDomain??"",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing spaces after colons

Suggested change
oktaDomain:(props.provider as any)?.oktaDomain??"",
oktaDomain: (props.provider as any)?.oktaDomain ?? "",
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
Line: 80:80

Comment:
**style:** missing spaces after colons

```suggestion
    oktaDomain: (props.provider as any)?.oktaDomain ?? "",
```

How can I resolve this? If you propose a fix, please make it concise.

};

const onSubmit = async (values: ProviderFormValues) => {
Expand All @@ -88,6 +91,7 @@ export function ProviderSettingDialog(props: Props & { open: boolean, onClose: (
clientSecret: values.clientSecret || "",
facebookConfigId: values.facebookConfigId,
microsoftTenantId: values.microsoftTenantId,
oktaDomain:values.oktaDomain,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing space after colon

Suggested change
oktaDomain:values.oktaDomain,
oktaDomain: values.oktaDomain,
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
Line: 94:94

Comment:
**style:** missing space after colon

```suggestion
        oktaDomain: values.oktaDomain,
```

How can I resolve this? If you propose a fix, please make it concise.

});
}
};
Expand Down Expand Up @@ -166,6 +170,15 @@ export function ProviderSettingDialog(props: Props & { open: boolean, onClose: (
placeholder="Tenant ID"
/>
)}

{props.id === 'Okta' && (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: case mismatch - should be 'okta' (lowercase) to match the provider key in toTitle function and backend

Suggested change
{props.id === 'Okta' && (
{props.id === 'okta' && (
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
Line: 174:174

Comment:
**logic:** case mismatch - should be `'okta'` (lowercase) to match the provider key in `toTitle` function and backend

```suggestion
              {props.id === 'okta' && (
```

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{props.id === 'Okta' && (
{props.id === 'okta' && (

The condition checks for props.id === 'Okta' (capitalized), but the provider ID throughout the codebase is lowercase 'okta'. This means the Okta domain input field will never be displayed in the UI.

View Details

Analysis

Okta domain input field never renders due to incorrect provider ID case

What fails: The Okta domain input field is never displayed in the OAuth provider configuration dialog, preventing users from entering the required Okta domain when setting up Okta OAuth authentication.

How to reproduce:

  1. Navigate to the dashboard OAuth provider settings for Okta
  2. Enable Okta OAuth and attempt to configure it with custom credentials (not shared keys)
  3. Observe that the "Okta Domain" input field is missing from the form

Root cause: The condition at line 174 in apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx checks props.id === 'Okta' (capitalized), but the provider ID throughout the codebase is lowercase 'okta' (defined in apps/backend/src/oauth/index.tsx line 35 as okta:OktaProvider, and used in the toTitle mapping at line 47 as okta:"Okta"). This string comparison never matches, so the field is never rendered.

Expected behavior: The Okta domain input field should be displayed when configuring Okta OAuth, consistent with how the facebook and microsoft provider conditions work (lines 155 and 164, which use lowercase IDs).

Fix: Changed line 174 from props.id === 'Okta' to props.id === 'okta' to match the actual provider ID used throughout the codebase.

<InputField
control={form.control}
name="oktaDomain"
label="Okta Domain (required if you are using Okta)"
placeholder="oktaDomain"
/>
)}
Comment on lines +174 to +181
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Case mismatch prevents Okta domain field from rendering.

The condition checks props.id === 'Okta' (capitalized), but provider IDs are lowercase throughout the codebase. Looking at line 47, the toTitle mapping uses lowercase keys (okta: "Okta"). The similar checks for Facebook (line 156) and Microsoft (line 165) both use lowercase IDs. This condition will always be false, preventing the Okta domain input field from ever being displayed, which breaks the Okta configuration UI.

Apply this diff:

-              {props.id === 'Okta' && (
+              {props.id === 'okta' && (
                <InputField
                  control={form.control}
                  name="oktaDomain"
                  label="Okta Domain (required if you are using Okta)"
                  placeholder="oktaDomain"
                />
              )}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{props.id === 'Okta' && (
<InputField
control={form.control}
name="oktaDomain"
label="Okta Domain (required if you are using Okta)"
placeholder="oktaDomain"
/>
)}
{props.id === 'okta' && (
<InputField
control={form.control}
name="oktaDomain"
label="Okta Domain (required if you are using Okta)"
placeholder="oktaDomain"
/>
)}
🤖 Prompt for AI Agents
In
apps/dashboard/src/app/(main)/(protected)/projects/[projectId]/auth-methods/providers.tsx
around lines 174 to 181, the conditional rendering check uses props.id ===
'Okta' (capitalized) which never matches the lowercase provider IDs used
elsewhere; change the comparison to props.id === 'okta' to match the existing id
keys (consistent with the toTitle mapping and other provider checks) so the Okta
Domain InputField is rendered correctly.

</>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ it("returns an error when the oauth config is misconfigured", async ({ expect })
expect(invalidTypeResponse).toMatchInlineSnapshot(`
NiceResponse {
"status": 400,
"body": "auth.oauth.providers.invalid.type must be one of the following values: google, github, microsoft, spotify, facebook, discord, gitlab, bitbucket, linkedin, apple, x, twitch",
"body": "auth.oauth.providers.invalid.type must be one of the following values: google, github, microsoft, spotify, facebook, discord, gitlab, bitbucket, linkedin, apple, x, twitch,okta",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: missing space after comma

Suggested change
"body": "auth.oauth.providers.invalid.type must be one of the following values: google, github, microsoft, spotify, facebook, discord, gitlab, bitbucket, linkedin, apple, x, twitch,okta",
"body": "auth.oauth.providers.invalid.type must be one of the following values: google, github, microsoft, spotify, facebook, discord, gitlab, bitbucket, linkedin, apple, x, twitch, okta",
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/e2e/tests/backend/endpoints/api/v1/internal/config.test.ts
Line: 378:378

Comment:
**style:** missing space after comma

```suggestion
      "body": "auth.oauth.providers.invalid.type must be one of the following values: google, github, microsoft, spotify, facebook, discord, gitlab, bitbucket, linkedin, apple, x, twitch, okta",
```

How can I resolve this? If you propose a fix, please make it concise.

Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
"headers": Headers { <some fields may have been hidden> },
}
`);
Expand Down