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

v4: useUser/Auth0Provider loses Basic Auth credentials #1933

Open
6 tasks done
larsEichler opened this issue Feb 24, 2025 · 1 comment
Open
6 tasks done

v4: useUser/Auth0Provider loses Basic Auth credentials #1933

larsEichler opened this issue Feb 24, 2025 · 1 comment
Labels
ack bug Something isn't working

Comments

@larsEichler
Copy link

larsEichler commented Feb 24, 2025

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

@tusharpandey13
Copy link
Contributor

Thank you for reporting this issue and providing a clear reproduction repository!

The useUser hook is making fetch requests without including the credentials: 'include' option, which means the basic auth credentials aren't being sent with subsequent requests.

Thanks for bringing this to our attention. We are working on the fix and make a release soon.

@tusharpandey13 tusharpandey13 added bug Something isn't working ack labels Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ack bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants