Skip to content

Commit

Permalink
Neon OAuth: Allow client_id and client_secret in headers
Browse files Browse the repository at this point in the history
  • Loading branch information
N2D4 committed Dec 4, 2024
1 parent 85260a9 commit 33d7d99
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { prismaClient } from "@/prisma-client";
import { createSmartRouteHandler } from "@/route-handlers/smart-route-handler";
import { yupMixed, yupNumber, yupObject, yupString, yupUnion } from "@stackframe/stack-shared/dist/schema-fields";
import { yupMixed, yupNumber, yupObject, yupString, yupTuple, yupUnion } from "@stackframe/stack-shared/dist/schema-fields";
import { getEnvVariable } from "@stackframe/stack-shared/dist/utils/env";
import { StackAssertionError } from "@stackframe/stack-shared/dist/utils/errors";

Expand All @@ -14,10 +14,11 @@ export const POST = createSmartRouteHandler({
grant_type: yupString().oneOf(["authorization_code"]).defined(),
code: yupString().defined(),
code_verifier: yupString().defined(),
client_id: yupString().defined(),
client_secret: yupString().defined(),
redirect_uri: yupString().defined(),
}).defined(),
headers: yupObject({
authorization: yupTuple([yupString().defined()]).defined(),
}).defined(),
}),
response: yupUnion(
yupObject({
Expand All @@ -41,6 +42,7 @@ export const POST = createSmartRouteHandler({
body: new URLSearchParams(req.body).toString(),
headers: {
"Content-Type": "application/x-www-form-urlencoded",
Authorization: req.headers.authorization[0],
},
});
if (!tokenResponse.ok) {
Expand Down

0 comments on commit 33d7d99

Please sign in to comment.