[enter image description here](https://i.stack.imgur.com/cvbgZ.png)
This is my [...nextAuth.ts] for the nextAuth options.
I am facing error when i am registering a user using /api/register and it is responding with 307 status . Can anybody help me to solve this bug.
import bcrypt from "bcrypt";
import NextAuth, {AuthOptions} from "next-auth";
import CredentialsProvider from "next-auth/providers/credentials";
import GithubProvider from "next-auth/providers/github";
import GoogleProvider from "next-auth/providers/google";
import {PrismaAdapter} from "@next-auth/prisma-adapter";
import prisma from "@/app/libs/prismadb";
export const authOptions: AuthOptions = {
adapter: PrismaAdapter(prisma),
providers: \[
GithubProvider({
clientId: process.env.GITHUB_ID as string,
clientSecret: process.env.GITHUB_SECRET as string,
}),
GoogleProvider({
clientId: process.env.GOOGLE_CLIENT_ID as string,
clientSecret: process.env.GOOGLE_CLIENT_SECRET as string,
}),
CredentialsProvider({
id: "credentials",
name: "credentials",
credentials: {
email: {label: "email", type: "text"},
password: {label: "password", type: "password"},
},
async authorize(credentials) {
if (!credentials?.email || !credentials?.password) {
throw new Error("Invalid Credentials");
}
const user = await prisma.user.findUnique({
where: {
email: credentials.email,
},
});
if (!user || !user?.hashedPassword) {
throw new Error("Invalid Credentials");
}
const isCorrectPassword = await bcrypt.compare(
credentials.password,
user.hashedPassword
);
if (!isCorrectPassword) {
throw new Error("Invalid Credentials");
}
return user;
},
}),
\],
debug: process.env.NODE_ENV === "development",
session: {
strategy: "jwt",
},
secret: process.env.NEXTAUTH_SECRET,
};
const handler = NextAuth(authOptions);
export {handler as GET, handler as POST};
\`
This is my middleware.ts . It is used to protect the routes.
import {withAuth} from "next-auth/middleware";
export default withAuth({
pages: {
signIn: "/",
},
});
export const confiq = {
matcher: \["/users/:path\*", "/conversations/:path\*"\],
};
A 307 Temporary Redirect status code indicates that the requested resource has been temporarily moved to a different URL. When a client sends a request, and the server responds with a 307 status code,