The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
store code_challenge
Kiran K01a5df4f18fb
diff --git a/apps/web/app/api/oauth/authorize/route.ts b/apps/web/app/api/oauth/authorize/route.tsindex cfa31430a3..773da6cd13 100644--- a/apps/web/app/api/oauth/authorize/route.ts+++ b/apps/web/app/api/oauth/authorize/route.ts@@ -14,9 +14,11 @@ import { NextResponse } from "next/server";export const POST = withWorkspace(async ({ session, req, workspace }) => {const {state,+ scope,client_id: clientId,redirect_uri: redirectUri,- scope,+ code_challenge: codeChallenge,+ code_challenge_method: codeChallengeMethod,} = authorizeRequestSchema.parse(await parseRequestBody(req));const oAuthApp = await prisma.oAuthApp.findUniqueOrThrow({@@ -40,6 +42,8 @@ export const POST = withWorkspace(async ({ session, req, workspace }) => {userId: session.user.id,scopes: scope.join(" "),code: nanoid(OAUTH_CODE_LENGTH),+ codeChallenge,+ codeChallengeMethod,expiresAt: new Date(Date.now() + OAUTH_CODE_LIFETIME * 1000),},});diff --git a/apps/web/lib/zod/schemas/oauth.ts b/apps/web/lib/zod/schemas/oauth.tsindex a07ea02400..b6436132c8 100644--- a/apps/web/lib/zod/schemas/oauth.ts+++ b/apps/web/lib/zod/schemas/oauth.ts@@ -69,6 +69,10 @@ export const authorizeRequestSchema = z.object({message: "Invalid scopes",},),++ // PKCE flow+ code_challenge: z.string().max(255).optional(),+ code_challenge_method: z.string().optional().default("plain"),});// Schema for OAuth2.0 code exchange requestdiff --git a/apps/web/prisma/schema.prisma b/apps/web/prisma/schema.prismaindex c804c60ef8..6bcd69a862 100644--- a/apps/web/prisma/schema.prisma+++ b/apps/web/prisma/schema.prisma@@ -399,6 +399,8 @@ model OAuthCode {code String @uniquescopes String?redirectUri String+ codeChallenge String?+ codeChallengeMethod String?expiresAt DateTimecreatedAt DateTime @default(now())