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.

Simplify OAuth scopes (remove workspace resource)

Steven Teyc49f03a9dd8a
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.tsx
index f4391ff05e..6641487901 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
@@ -10,10 +10,6 @@ import { useEffect, useState } from "react";
import { toast } from "sonner";
import { z } from "zod";
-interface AuthorizeFormProps extends z.infer<typeof authorizeRequestSchema> {
- //
-}
-
export const AuthorizeForm = ({
client_id,
redirect_uri,
@@ -22,7 +18,7 @@ export const AuthorizeForm = ({
scope,
code_challenge,
code_challenge_method,
-}: AuthorizeFormProps) => {
+}: z.infer<typeof authorizeRequestSchema>) => {
const { data: session } = useSession();
const { workspaces } = useWorkspaces();
const [submitting, setSubmitting] = useState(false);
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.tsx
index 59f26d720d..7884e4f5f6 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
@@ -1,4 +1,4 @@
-import { vaidateAuthorizeRequest } from "@/lib/api/oauth/actions";
+import { validateAuthorizeRequest } from "@/lib/api/oauth/actions";
import { getSession } from "@/lib/auth";
import { authorizeRequestSchema } from "@/lib/zod/schemas/oauth";
import EmptyState from "@/ui/shared/empty-state";
@@ -29,7 +29,7 @@ export default async function Authorize(props: {
}
const { error, integration, requestParams } =
- await vaidateAuthorizeRequest(searchParams);
+ await validateAuthorizeRequest(searchParams);
if (error || !integration) {
return (
diff --git a/apps/web/lib/api/oauth/actions.ts b/apps/web/lib/api/oauth/actions.ts
index 9fa24c302f..03c8ccb64d 100644
--- a/apps/web/lib/api/oauth/actions.ts
+++ b/apps/web/lib/api/oauth/actions.ts
@@ -4,7 +4,7 @@ import { prisma } from "@dub/prisma";
import { authorizeRequestSchema } from "../../zod/schemas/oauth";
import { fromZodError } from "../errors";
-export const vaidateAuthorizeRequest = async (params: any) => {
+export const validateAuthorizeRequest = async (params: any) => {
const request = authorizeRequestSchema.safeParse(params);
if (!request.success) {
diff --git a/apps/web/lib/api/oauth/constants.ts b/apps/web/lib/api/oauth/constants.ts
index 32452ae610..b971b906aa 100644
--- a/apps/web/lib/api/oauth/constants.ts
+++ b/apps/web/lib/api/oauth/constants.ts
@@ -19,8 +19,6 @@ export const OAUTH_CONFIG = {
// Keep it separate from the actual scopes to avoid confusion
// We don't want all the scopes to be requested by an app
export const OAUTH_SCOPES = [
- "workspaces.read",
- "workspaces.write",
"links.read",
"links.write",
"tags.read",
@@ -37,8 +35,6 @@ export const OAUTH_SCOPES = [
// Scope descriptions
export const OAUTH_SCOPE_DESCRIPTIONS = {
- "workspaces.read": "Read access to workspace",
- "workspaces.write": "Read and Write access to workspace",
"links.read": "Read access to links",
"links.write": "Read and Write access to links",
"tags.read": "Read access to tags",