Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error message passed to custom page #3273

Closed
wants to merge 1 commit into from
Closed

fix: error message passed to custom page #3273

wants to merge 1 commit into from

Conversation

adipasquale
Copy link

Reasoning 💡

I encountered a bug when using a custom page: the error querystring param is always undefined. This is a potential fix.

Steps to reproduce the bug on main:

  1. set this config in [...nextauth].ts file like:
import { PrismaAdapter } from "@next-auth/prisma-adapter";
import NextAuth from "next-auth";
import EmailAuthProvider from "next-auth/providers/email";
import { PrismaClient } from "@prisma/client";

export default NextAuth({
  adapter: PrismaAdapter(new PrismaClient()),
  callbacks: {
    signIn({ user }) {
      if (typeof user.email !== "string") return false;
      return (user.email.endsWith("lycos.fr"))
    },
  },
  pages: {
    error: "/auth/error",
  },
  providers: [
    EmailAuthProvider({
      from: process.env.EMAIL_FROM,
      server: process.env.EMAIL_SERVER
    }),
  ],
});
  1. set EMAIL_FROM and EMAIL_SERVER to variables that you can use (maybe use maildev)
  2. try to login using the email provider and an email address different from *@lycos.fr

Checklist 🧢

To check an item, place an x in the box like so: - [x] Documentation. -->

  • Documentation
  • Tests
  • Ready to be merged

Affected issues 🎟

@github-actions github-actions bot added the core Refers to `@auth/core` label Nov 24, 2021
@adipasquale
Copy link
Author

woups sorry for the dup this was fixed by #3141

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Refers to `@auth/core`
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant