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.

add prefix to clientId

Steven Tey0b75e46dd5fb
diff --git a/apps/web/app/api/oauth-apps/route.ts b/apps/web/app/api/oauth-apps/route.ts
index 3a68ffc843..9d36815e73 100644
--- a/apps/web/app/api/oauth-apps/route.ts
+++ b/apps/web/app/api/oauth-apps/route.ts
@@ -30,15 +30,16 @@ export const POST = withWorkspace(
const { name, developer, website, redirectUri, logo, pkce } =
createOAuthAppSchema.parse(await parseRequestBody(req));
+ const clientId = createToken({
+ length: OAUTH_CONFIG.CLIENT_ID_LENGTH,
+ prefix: OAUTH_CONFIG.CLIENT_ID_PREFIX,
+ });
+
const clientSecret = createToken({
length: OAUTH_CONFIG.CLIENT_SECRET_LENGTH,
prefix: OAUTH_CONFIG.CLIENT_SECRET_PREFIX,
});
- const clientId = createToken({
- length: OAUTH_CONFIG.CLIENT_ID_LENGTH,
- });
-
const client = await prisma.oAuthApp.create({
data: {
projectId: workspace.id,
diff --git a/apps/web/lib/api/oauth/constants.ts b/apps/web/lib/api/oauth/constants.ts
index 56ebb816de..e574186948 100644
--- a/apps/web/lib/api/oauth/constants.ts
+++ b/apps/web/lib/api/oauth/constants.ts
@@ -10,8 +10,7 @@ export const OAUTH_CONFIG = {
REFRESH_TOKEN_LENGTH: 40,
CODE_LENGTH: 40,
- // TODO:
- // Keep it short and simple (Discuss with Steven)
+ CLIENT_ID_PREFIX: "dub_app_",
CLIENT_SECRET_PREFIX: "dub_app_secret_",
};