Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

make sure to redirect user on github error

Sara Vieira34eb450f3ecc
diff --git a/app/routes/auth/github/callback.tsx b/app/routes/auth/github/callback.tsx
index fbbfa77838..4cb72c2afc 100644
--- a/app/routes/auth/github/callback.tsx
+++ b/app/routes/auth/github/callback.tsx
@@ -1,10 +1,21 @@
-import { LoaderFunction } from "@remix-run/node";
+import { LoaderFunction, redirect } from "@remix-run/node";
import config from "~/config";
import { authenticator } from "~/services/auth.server";
import { ensureUserCookie } from "~/shared/session";
+import { LOGIN_ERROR_CODES } from "~/shared/session/useLoginErrors";
export const loader: LoaderFunction = async ({ request }) => {
const { userId } = await ensureUserCookie(request);
+ const url = new URL(request.url);
+ const error = url.searchParams.get("error");
+ const error_description = url.searchParams.get("error_description");
+ if (error) {
+ return redirect(
+ `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_GITHUB}&message=${
+ error_description || error
+ }`
+ );
+ }
return authenticator.authenticate("github", request, {
context: {
userId,