fix: update wrong oauth tests and parseRequestData util (#19958)

* update oauth tests

* fix parseRequestData

* add logging

* add fallback

* use ??

* updates

* use parseUrlFormData in saml/callback

* update tests

* fix

* remove log

* update

* any -> unknown

* use HttpErrors

* addressed

* unknown -> any
This commit is contained in:
Benny Joo authored and GitHub committed 2025-03-11 14:01:48 +00:00
1 parent dc3c7b43bf
commit e3e624464d
4 files changed
+80 -49

No files matched your search

@@ -1,4 +1,4 @@
import { parseRequestData } from "app/api/parseRequestData";
import { parseUrlFormData } from "app/api/parseRequestData";
import jwt from "jsonwebtoken";
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
@@ -8,7 +8,7 @@ import { generateSecret } from "@calcom/trpc/server/routers/viewer/oAuth/addClie
import type { OAuthTokenPayload } from "@calcom/types/oauth";
export async function POST(req: NextRequest) {
const { client_id, client_secret, grant_type } = await parseRequestData(req);
const { client_id, client_secret, grant_type } = await parseUrlFormData(req);
if (!client_id || !client_secret) {
return NextResponse.json({ message: "Missing client id or secret" }, { status: 400 });
+2 -3
View File
@@ -1,4 +1,4 @@
import { parseRequestData } from "app/api/parseRequestData";
import { parseUrlFormData } from "app/api/parseRequestData";
import jwt from "jsonwebtoken";
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
@@ -8,8 +8,7 @@ import { generateSecret } from "@calcom/trpc/server/routers/viewer/oAuth/addClie
import type { OAuthTokenPayload } from "@calcom/types/oauth";
export async function POST(req: NextRequest) {
const { code, client_id, client_secret, grant_type, redirect_uri } = await parseRequestData(req);
const { code, client_id, client_secret, grant_type, redirect_uri } = await parseUrlFormData(req);
if (grant_type !== "authorization_code") {
return NextResponse.json({ message: "grant_type invalid" }, { status: 400 });
}