Skip to content

Login page silently ignores sign-in errors (e.g. ?error=OAuthCallback) #524

Open

Description

@Miablo

Describe the bug

When sign-in fails during the OAuth callback, NextAuth redirects /auth/login?error=<code>, but the login page ignores the error query param and renders the normal "Sign in with GitHub" card. The user ends up back where they started with no indication anything went wrong; the only signal is an Auth error line in the server logs.

NextAuth sends these errors to the sign-in page rather than /auth/error: OAuthSignin, OAuthCallback, OAuthCreateAccount, Callback, OAuthAccountNotLinked, SessionRequired, and Default.

To Reproduce

  1. Set NEXTAUTH_URL to a URL other than the one you browse from (e.g. a tunnel URL, while opening http://localhost:3000)
  2. Click Sign in with GitHub and authorize
  3. The server logs OAUTH_CALLBACK_ERROR … State cookie was missing
  4. The browser lands on /auth/login?error=OAuthCallback showing the normal login card, with no error

Expected behavior

The login page shows an error message (e.g. an ErrorFlash above the login card) when error is present, with a short user-facing message per error code and a generic fallback, so users know to retry or contact an admin.

Screenshots

No response

Additional context

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions