Next Auth custom sign in page not redirecting

I was encountering a problem with the next auth redirect after a user signs in with one of the authentication providers. This started to occur after I made a custom sign in page on the route page/auth/signin .

To get the redirects working again you need to add the following code to the next auth options in the [...nextauth].ts file.

callbacks: {
    async signIn({ user, account, profile, email, credentials }) {
      return true;
    async redirect({ url, baseUrl }) {
      return "/dashboard";

Where /dashboard here is the page you want the user to be redirected to after successful login.