Is it possible to use two middleware?
Unanswered
adam.birds posted this in #help-forum
Is it possible to use two middleware? I use the middleware for NextAuth to ensure the dashboard side requires authentication. But I also want to use a middle ware for a/b testing with feature flags and also potentially other things but can't seem to see how.
My current
My current
middleware.ts for reference is:import {withAuth} from "next-auth/middleware";
export default withAuth({
pages: {
signIn: "/login",
error: "/not-found",
},
});
export const config = {
matcher: ["/dashboard:path*", "/ebay-auth", "/ebay-callback"],
};2 Replies
Hello!
Some time ago I had similiar issues and I've commited an package for that:
https://www.npmjs.com/package/next-easy-middlewares
If you will run into any trouble feel free to ping me there or open new issue on github 🙂
I'm right now preparing this package for usage with NextAuth, but there is temp workaround in ongoing issue:
https://github.com/z4nr34l/next-easy-middlewares/issues/16
Happy coding!
Some time ago I had similiar issues and I've commited an package for that:
https://www.npmjs.com/package/next-easy-middlewares
If you will run into any trouble feel free to ping me there or open new issue on github 🙂
I'm right now preparing this package for usage with NextAuth, but there is temp workaround in ongoing issue:
https://github.com/z4nr34l/next-easy-middlewares/issues/16
Happy coding!
FYI: Above issue is solved in latest version of package 🙂