Remove THROW_ON_AUTH_ERROR

This commit is contained in:
Kalle 2023-09-28 21:25:07 +03:00
parent 3c862d6e81
commit 6bfdfecd27

View File

@ -18,8 +18,6 @@ import { deleteLogInLinkByCode } from "./queries/deleteLogInLinkByCode.server";
import { db } from "~/db";
import isbot from "isbot";
const throwOnAuthErrors = process.env["THROW_ON_AUTH_ERROR"] === "true";
export const callbackLoader: LoaderFunction = async ({ request }) => {
const url = new URL(request.url);
if (url.searchParams.get("error") === "access_denied") {
@ -33,8 +31,7 @@ export const callbackLoader: LoaderFunction = async ({ request }) => {
await authenticator.authenticate(DISCORD_AUTH_KEY, request, {
successRedirect: "/",
failureRedirect: throwOnAuthErrors ? undefined : authErrorUrl("unknown"),
throwOnError: throwOnAuthErrors,
failureRedirect: authErrorUrl("unknown"),
});
throw new Response("Unknown authentication state", { status: 500 });