The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
clientSecretHashed → hashedClientSecret
Steven Tey2246c9a916da
diff --git a/apps/web/app/api/oauth-apps/route.ts b/apps/web/app/api/oauth-apps/route.tsindex 54aabe09d5..3a68ffc843 100644--- a/apps/web/app/api/oauth-apps/route.ts+++ b/apps/web/app/api/oauth-apps/route.ts@@ -48,7 +48,7 @@ export const POST = withWorkspace(redirectUri,logo,clientId,- clientSecretHashed: await hashToken(clientSecret),+ hashedClientSecret: await hashToken(clientSecret),userId: session.user.id,pkce,},diff --git a/apps/web/app/api/oauth/token/exchange-code-for-token.ts b/apps/web/app/api/oauth/token/exchange-code-for-token.tsindex 9b9759f2a8..46f03f5e16 100644--- a/apps/web/app/api/oauth/token/exchange-code-for-token.ts+++ b/apps/web/app/api/oauth/token/exchange-code-for-token.ts@@ -51,7 +51,7 @@ export const exchangeAuthCodeForToken = async (select: {name: true,pkce: true,- clientSecretHashed: true,+ hashedClientSecret: true,},});@@ -81,7 +81,7 @@ export const exchangeAuthCodeForToken = async (});}- if (app.clientSecretHashed !== (await hashToken(clientSecret))) {+ if (app.hashedClientSecret !== (await hashToken(clientSecret))) {throw new DubApiError({code: "unauthorized",message: "Invalid client_secret",diff --git a/apps/web/app/api/oauth/token/refresh-access-token.ts b/apps/web/app/api/oauth/token/refresh-access-token.tsindex c978027a24..c813618455 100644--- a/apps/web/app/api/oauth/token/refresh-access-token.ts+++ b/apps/web/app/api/oauth/token/refresh-access-token.ts@@ -49,7 +49,7 @@ export const refreshAccessToken = async (select: {name: true,pkce: true,- clientSecretHashed: true,+ hashedClientSecret: true,},});@@ -68,7 +68,7 @@ export const refreshAccessToken = async (});}- if (app.clientSecretHashed !== (await hashToken(clientSecret))) {+ if (app.hashedClientSecret !== (await hashToken(clientSecret))) {throw new DubApiError({code: "unauthorized",message: "Invalid client_secret",diff --git a/apps/web/prisma/schema/oauth.prisma b/apps/web/prisma/schema/oauth.prismaindex 0c435bec3b..edf75f2fc6 100644--- a/apps/web/prisma/schema/oauth.prisma+++ b/apps/web/prisma/schema/oauth.prisma@@ -4,7 +4,7 @@ model OAuthApp {name Stringdeveloper Stringwebsite String- clientSecretHashed String+ hashedClientSecret StringredirectUri Stringlogo String?pkce Boolean @default(false)@@ -21,6 +21,7 @@ model OAuthApp {authorizedApps OAuthAuthorizedApp[]@@index(projectId)+ @@index([userId])}model OAuthCode {@@ -39,6 +40,10 @@ model OAuthCode {oAuthApp OAuthApp @relation(fields: [clientId], references: [clientId], onDelete: Cascade)user User @relation(fields: [userId], references: [id], onDelete: Cascade)project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)++ @@index([clientId])+ @@index([userId])+ @@index([projectId])}model OAuthRefreshToken {@@ -52,7 +57,8 @@ model OAuthRefreshToken {oAuthApp OAuthApp @relation(fields: [clientId], references: [clientId], onDelete: Cascade)accessToken RestrictedToken @relation(fields: [accessTokenId], references: [id], onDelete: Cascade)- @@index(accessTokenId)+ @@index([clientId])+ @@index([accessTokenId])}model OAuthAuthorizedApp {@@ -67,4 +73,6 @@ model OAuthAuthorizedApp {project Project @relation(fields: [projectId], references: [id], onDelete: Cascade)@@unique([userId, projectId, clientId])+ @@index([clientId])+ @@index([projectId])}