Skip to content

Commit

Permalink
toWebRequest?
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusmarminge committed Nov 8, 2023
1 parent 3a56145 commit 28250db
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions apps/auth-proxy/routes/api/[...auth].ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import type { AuthConfig } from "@auth/core";
import { Auth } from "@auth/core";
import Discord from "@auth/core/providers/discord";
import { eventHandler, getHeaders, getRequestURL, readBody } from "h3";
import { eventHandler, toWebRequest } from "h3";

export default eventHandler(async (event) => {
const request = new Request(getRequestURL(event), {
method: event.method,
headers: getHeaders(event) as unknown as Headers,
body: event.method === "POST" ? await readBody(event) : undefined,
});

const config = {
secret: process.env.AUTH_SECRET,
trustHost: !!process.env.VERCEL,
Expand All @@ -22,5 +16,5 @@ export default eventHandler(async (event) => {
],
} satisfies AuthConfig;

return Auth(request, config);
return Auth(toWebRequest(event), config);
});

0 comments on commit 28250db

Please sign in to comment.