Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

pushed schema changes, update partialClientSecret pattern

Steven Teye6f27a6d012b
diff --git a/apps/web/app/api/oauth/apps/route.ts b/apps/web/app/api/oauth/apps/route.ts
index 2fa9a86c1f..0eca2e7328 100644
--- a/apps/web/app/api/oauth/apps/route.ts
+++ b/apps/web/app/api/oauth/apps/route.ts
@@ -86,7 +86,7 @@ export const POST = withWorkspace(
logo,
clientId,
hashedClientSecret: await hashToken(clientSecret),
- partialClientSecret: `${clientSecret.slice(0, 3)}...${clientSecret.slice(-4)}`,
+ partialClientSecret: `dub_app_secret_****${clientSecret.slice(-8)}`,
userId: session.user.id,
pkce,
},
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/[integrationId]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/[integrationId]/page-client.tsx
index 197eebe56e..11cb850fcc 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/[integrationId]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/integrations/manage/[integrationId]/page-client.tsx
@@ -148,7 +148,7 @@ export default function IntegrationManagePageClient({
searchParams.get("client_secret") ||
null
}
- partialClientSecret={integration.partialClientSecret || null}
+ partialClientSecret={integration.partialClientSecret}
/>
<hr />
<AddEditIntegrationForm integration={integration} />
diff --git a/apps/web/lib/actions/generate-client-secret.ts b/apps/web/lib/actions/generate-client-secret.ts
index bbb77347c9..cf3b3bd4ed 100644
--- a/apps/web/lib/actions/generate-client-secret.ts
+++ b/apps/web/lib/actions/generate-client-secret.ts
@@ -37,7 +37,7 @@ export const generateClientSecret = authActionClient
},
data: {
hashedClientSecret: await hashToken(clientSecret),
- partialClientSecret: `${clientSecret.slice(0, 3)}...${clientSecret.slice(-4)}`,
+ partialClientSecret: `dub_app_secret_****${clientSecret.slice(-8)}`,
},
});
diff --git a/apps/web/lib/zod/schemas/oauth.ts b/apps/web/lib/zod/schemas/oauth.ts
index 7f2b3f6de9..adc320a8c6 100644
--- a/apps/web/lib/zod/schemas/oauth.ts
+++ b/apps/web/lib/zod/schemas/oauth.ts
@@ -59,8 +59,7 @@ export const updateOAuthAppSchema = createOAuthAppSchema.partial();
export const oAuthAppSchema = z.object({
id: z.string(),
clientId: z.string(),
- clientSecret: z.string().optional(),
- partialClientSecret: z.string().optional(),
+ partialClientSecret: z.string(),
name: z.string(),
slug: z.string(),
description: z.string().nullish(),
diff --git a/apps/web/prisma/schema/oauth.prisma b/apps/web/prisma/schema/oauth.prisma
index 303c9d7ea2..1d73886392 100644
--- a/apps/web/prisma/schema/oauth.prisma
+++ b/apps/web/prisma/schema/oauth.prisma
@@ -8,7 +8,7 @@ model OAuthApp {
developer String
website String
hashedClientSecret String
- partialClientSecret String?
+ partialClientSecret String
redirectUris Json
logo String?
pkce Boolean @default(false)
diff --git a/apps/web/ui/integrations/oauth-app-credentials.tsx b/apps/web/ui/integrations/oauth-app-credentials.tsx
index dc2c7d0f9a..17c0c4cbc6 100644
--- a/apps/web/ui/integrations/oauth-app-credentials.tsx
+++ b/apps/web/ui/integrations/oauth-app-credentials.tsx
@@ -7,9 +7,9 @@ export default function OAuthAppCredentials({
clientSecret,
partialClientSecret,
}: {
- clientId: string | null;
+ clientId: string;
clientSecret: string | null;
- partialClientSecret: string | null;
+ partialClientSecret: string;
}) {
if (!clientId) {
return null;
@@ -27,7 +27,7 @@ export default function OAuthAppCredentials({
</div>
</div>
- {clientSecret && (
+ {clientSecret ? (
<div className="space-y-2">
<label className="text-sm font-medium text-gray-500">
Client Secret
@@ -45,9 +45,7 @@ export default function OAuthAppCredentials({
again.
</span>
</div>
- )}
-
- {!clientSecret && partialClientSecret && (
+ ) : (
<div className="space-y-2">
<label className="text-sm font-medium text-gray-500">
Client Secret