Skip to content

Too Many Redirects when change authentication to better-auth #737

@luisalbuquerque00

Description

@luisalbuquerque00

Describe the bug
I switched the authentication method from Clerk to Better-Auth, and whenever I try to access the sign-in/sign-up page, I get the error message "too many redirects."

I believe the problem lies in this section of the code:

// auth/proxy.ts

if (!sessionCookie) {
  return NextResponse.redirect(new URL("/sign-in", request.url));
}

next-forge version
I am using version 5.3.2

To Reproduce
Steps to reproduce the behavior:

  1. Change Clerk to Better-Auth
  2. Clear cookies
  3. Go to sign-in page
  4. Error too many redirect trigged
  5. See error

Expected behavior
Switching the authentication method should work exactly as it does when using Clerk as the authentication provider.

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Chrome/Arc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions