NextAuth - Login not working
Unanswered
Great Auk posted this in #help-forum
Great AukOP
Hi. I don't know why my login system isn't working. I have a login form & a valid user (it says that my login was successful) but no idea.
signIn("credentials", {
...values,
redirect: false,
callbackUrl: "/app",
}).then((callback) => {
if (callback?.error) {
toast({ title: "Invalid credentials" });
}
if (callback?.ok) {
console.log("hello");
toast({ title: "Logged in!" });
router.push("/app");
}
});2 Replies
Great AukOP
I'm also using this middleware
import { withAuth } from "next-auth/middleware";
export default withAuth({
pages: {
signIn: "/auth/login",
},
});
// This ensures that all pages specified in the array, will be protected
export const config = {
matcher: ["/app/:path*"],
};I can't access the /app page