Fix: Add testing
This commit is contained in:
parent
d022d9fcf6
commit
ed6195e1e2
22 changed files with 338 additions and 87 deletions
|
@ -11,12 +11,11 @@ import { discord, lucia } from "~/lib/auth";
|
|||
import { paths } from "~/types/discord";
|
||||
|
||||
export async function GET(event: APIEvent): Promise<Response> {
|
||||
const code = new URL(event.request.url).searchParams.get("code");
|
||||
const state = new URL(event.request.url).searchParams.get("state");
|
||||
const error = new URL(event.request.url).searchParams.get("error");
|
||||
const error_description = new URL(event.request.url).searchParams.get(
|
||||
"error_description",
|
||||
);
|
||||
const url = new URL(event.request.url);
|
||||
const code = url.searchParams.get("code");
|
||||
const state = url.searchParams.get("state");
|
||||
const error = url.searchParams.get("error");
|
||||
const error_description = url.searchParams.get("error_description");
|
||||
if (error)
|
||||
switch (error) {
|
||||
case "access_denied":
|
||||
|
@ -61,7 +60,6 @@ export async function GET(event: APIEvent): Promise<Response> {
|
|||
{ sessionId: createId() },
|
||||
);
|
||||
const sessionCookie = lucia.createSessionCookie(session.id);
|
||||
console.log(sessionCookie);
|
||||
setCookie(
|
||||
sessionCookie.name,
|
||||
sessionCookie.value,
|
||||
|
@ -100,7 +98,6 @@ export async function GET(event: APIEvent): Promise<Response> {
|
|||
})
|
||||
.returning()
|
||||
.execute();
|
||||
console.log(createId(), createId(), { warst: createId() });
|
||||
const session = await lucia.createSession(
|
||||
userId,
|
||||
{},
|
||||
|
|
|
@ -4,6 +4,9 @@ import httpStatus from "http-status";
|
|||
import { setCookie } from "vinxi/http";
|
||||
import { discord } from "~/lib/auth";
|
||||
|
||||
if (typeof import.meta.env.PROD === "undefined")
|
||||
throw new Error("No env PROD found!");
|
||||
|
||||
export async function GET(event: APIEvent) {
|
||||
const state = generateState();
|
||||
const url = await discord.createAuthorizationURL(state, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue