Skip to content

Commit

Permalink
fix(nextjs): Use signInUrl and signUpUrl from the env
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosdouvlis committed May 4, 2023
1 parent fdd347a commit 93eeff6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/nextjs/src/server/authMiddleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { NextResponse } from 'next/server';

import { isRedirect, mergeResponses, paths, setHeader } from '../utils';
import { authenticateRequest, handleInterstitialState, handleUnknownState } from './authenticateRequest';
import { SIGN_IN_URL, SIGN_UP_URL } from './clerkClient';
import { receivedRequestForIgnoredRoute } from './errors';
import { redirectToSignIn } from './redirect';
import type { NextMiddlewareResult, WithAuthOptions } from './types';
Expand Down Expand Up @@ -181,7 +182,11 @@ const withDefaultPublicRoutes = (publicRoutes: RouteMatcherParam | undefined) =>
return publicRoutes;
}
const routes = [publicRoutes || ''].flat().filter(Boolean);
routes.push(matchRoutesStartingWith(TMP_SIGN_IN_URL));
routes.push(matchRoutesStartingWith(TMP_SIGN_UP_URL));
if (SIGN_IN_URL) {
routes.push(matchRoutesStartingWith(SIGN_IN_URL));
}
if (SIGN_UP_URL) {
routes.push(matchRoutesStartingWith(SIGN_UP_URL));
}
return routes;
};

0 comments on commit 93eeff6

Please sign in to comment.