I don't know how to use 'next-auth/middleware' and 'next-intl/middleware' together in the middleware. Next-auth gets exported as default and it's a must... on the other hand Next-intl creates a middleware and add a separate config...
export { default } from "next-auth/middleware";
export const config = {
matcher: ["/((?!register|api|login).*)"],
};
import createMiddleware from "next-intl/middleware";
export default createMiddleware({
locales: ["en", "es"],
defaultLocale: "en",
});
export const config = {
// Skip all paths that should not be internationalized
matcher: ["/((?!api|_next|.*\\..*).*)"],
};
I tried to search on google to use these two together but there was no blog. I don't know how these two are going to be in a single middleware export