From 817d1b3f641eb8343a1338600e12d455c15c15d3 Mon Sep 17 00:00:00 2001 From: Peter Phanouvong Date: Wed, 15 May 2024 13:57:51 +1000 Subject: [PATCH] feat: add redirectURLBase to options --- src/authMiddleware/authMiddleware.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/authMiddleware/authMiddleware.js b/src/authMiddleware/authMiddleware.js index 7c141ef..ca4a455 100644 --- a/src/authMiddleware/authMiddleware.js +++ b/src/authMiddleware/authMiddleware.js @@ -55,7 +55,7 @@ const handleMiddleware = async (req, options, onSuccess) => { if (!kindeToken) { const response = NextResponse.redirect( - new URL(loginRedirectUrl, config.redirectURL) + new URL(loginRedirectUrl, options.redirectURLBase || config.redirectURL) ); return response; } @@ -84,7 +84,9 @@ const handleMiddleware = async (req, options, onSuccess) => { return; } - return NextResponse.redirect(new URL(loginRedirectUrl, config.redirectURL)); + return NextResponse.redirect( + new URL(loginRedirectUrl, options.redirectURLBase || config.redirectURL) + ); }; /**