Skip to content

Commit

Permalink
Remove THROW_ON_AUTH_ERROR
Browse files Browse the repository at this point in the history
  • Loading branch information
Sendouc committed Sep 28, 2023
1 parent 3c862d6 commit 6bfdfec
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions app/modules/auth/routes.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand All @@ -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 });
Expand Down

0 comments on commit 6bfdfec

Please sign in to comment.