Skip to content

v4: useUser/Auth0Provider loses Basic Auth credentials #1933

Open
@larsEichler

Description

@larsEichler

Checklist

Description

WE have a basic auth middleware in our application to protect staging environments. Implementing a component using the useUser-hook loses the the basic-auth-credentials (also having all failing 401 errors for every /auth/profile request in the console is annoying as hell).

Reproduction

  1. Clone the example repo: https://github.com/larsEichler/auth0-nextjs-middleware-basic-auth-issue
  2. Set up an Auth0 Application
  3. Clone .env.dist -> .env
  4. Provide Auth0 Env-Credentials
  5. Start app and log in with basic auth: user:pass
  6. Navigate through the menu
  7. Basic auth will reappear

Additional context

This problem seems not to be directly tied to auth0 but SWR. When throwing an error from the SWR fetcher, Basic Auth headers are being lost.

nextjs-auth0 version

4.0.1

Next.js version

15.1.7

Node.js version

22.14.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    ackbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions