The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
update the authorize form
Kiran K5f1d16adc1df
diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsxindex 2689182522..2d41a6c302 100644--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/authorize-form.tsx@@ -5,13 +5,12 @@ import z from "@/lib/zod";import { authorizeRequestSchema } from "@/lib/zod/schemas/oauth";import { Button, InputSelect, InputSelectItemProps } from "@dub/ui";import { DICEBEAR_AVATAR_URL } from "@dub/utils";-import { OAuthApp } from "@prisma/client";import { useSession } from "next-auth/react";import { useEffect, useMemo, useState } from "react";import { toast } from "sonner";interface AuthorizeFormProps extends z.infer<typeof authorizeRequestSchema> {- oAuthApp: Pick<OAuthApp, "name">;+ //}export const AuthorizeForm = ({diff --git a/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx b/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsxindex 155585a747..6e6add273b 100644--- a/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx+++ b/apps/web/app/app.dub.co/(auth)/oauth/authorize/page.tsx@@ -30,10 +30,10 @@ export default async function Authorize({redirect("/login");}- const { error, oAuthApp, requestParams } =+ const { error, integration, requestParams } =await vaidateAuthorizeRequest(searchParams);- if (error || !oAuthApp) {+ if (error || !integration) {return (<div className="relative z-10 mt-[calc(30vh)] h-fit w-full max-w-md overflow-hidden sm:rounded-2xl"><EmptyState icon={Logo} title={error} />@@ -45,11 +45,11 @@ export default async function Authorize({<div className="relative z-10 m-auto w-full max-w-md border-y border-gray-200 sm:rounded-2xl sm:border sm:shadow-xl"><div className="flex flex-col items-center justify-center space-y-6 border-b border-gray-200 bg-white px-4 py-6 pt-8 text-center sm:rounded-t-2xl sm:px-16"><div className="flex items-center gap-3">- <a href={oAuthApp.website} target="_blank" rel="noreferrer">- {oAuthApp.logo ? (+ <a href={integration.website} target="_blank" rel="noreferrer">+ {integration.logo ? (<BlurImage- src={oAuthApp.logo}- alt={`Logo for ${oAuthApp.name}`}+ src={integration.logo}+ alt={`Logo for ${integration.name}`}className="size-12 rounded-full border border-gray-200"width={20}height={20}@@ -64,18 +64,18 @@ export default async function Authorize({</a></div><p className="text-md">- <span className="font-bold">{oAuthApp.name}</span> is requesting API- access to a workspace on Dub.+ <span className="font-bold">{integration.name}</span> is requesting+ API access to a workspace on Dub.</p><span className="text-xs text-gray-500">Built by{" "}<a- href={oAuthApp.website}+ href={integration.website}target="_blank"rel="noreferrer"className="underline">- {oAuthApp.developer}+ {integration.developer}</a></span></div>@@ -84,7 +84,7 @@ export default async function Authorize({</div><div className="flex flex-col space-y-2 border-t border-gray-200 bg-white px-2 py-6 sm:rounded-b-2xl sm:px-10"><Suspense>- <AuthorizeForm oAuthApp={oAuthApp} {...requestParams} />+ <AuthorizeForm {...requestParams} /></Suspense></div></div>diff --git a/apps/web/lib/api/oauth/actions.ts b/apps/web/lib/api/oauth/actions.tsindex 996f7295d3..b8f78c2d7e 100644--- a/apps/web/lib/api/oauth/actions.ts+++ b/apps/web/lib/api/oauth/actions.ts@@ -21,9 +21,20 @@ export const vaidateAuthorizeRequest = async (params: any) => {where: {clientId,},+ select: {+ redirectUris: true,+ integration: {+ select: {+ name: true,+ developer: true,+ website: true,+ logo: true,+ },+ },+ },});- if (!oAuthApp) {+ if (!oAuthApp || !oAuthApp.integration) {return {error: "Could not find OAuth application.",};@@ -38,7 +49,7 @@ export const vaidateAuthorizeRequest = async (params: any) => {}return {- oAuthApp,+ integration: { ...oAuthApp.integration },requestParams: request.data,};};