nextjs-auth0 icon indicating copy to clipboard operation
nextjs-auth0 copied to clipboard

Logout not clearing session cookie when base path is set

Open mustafahasan opened this issue 1 year ago • 4 comments

Checklist

  • [x] The issue can be reproduced in the nextjs-auth0 sample app (or N/A).
  • [x] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • [x] I have looked into the API documentation and have not found a suitable solution or answer.
  • [x] I have searched the issues and have not found a suitable solution or answer.
  • [x] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • [x] I agree to the terms within the Auth0 Code of Conduct.

Description

When a base path is set for the application, the default logout route is not clearing the correct session cookie. Looking at the console logs, it appears to be clearing the session cookie set at a root level (/) but not the session cookie that is set at the base path level.

Reproduction

  1. Follow the ReadMe to set a base path for your application.
  2. Login to the application and you’ll notice that the cookie is set at the correct base path specified.
  3. Logout of the application and you’ll notice that the session cookies are still there (the wrong ones were cleared)

Additional context

No response

nextjs-auth0 version

4.8.0

Next.js version

15.3.1

Node.js version

24.1.0

mustafahasan avatar Jul 08 '25 23:07 mustafahasan

here's a potential MR which may address the problem: https://github.com/auth0/nextjs-auth0/pull/2223

mustafagft avatar Jul 10 '25 00:07 mustafagft

Hi 👋 @mustafahasan, @mustafagft thanks for reporting and iterating on this, we'll take a look at this and release a solution soon 👍

tusharpandey13 avatar Jul 10 '25 09:07 tusharpandey13

Might this be related with #2237 ?

maurodaprotis avatar Jul 22 '25 17:07 maurodaprotis

This was fixed with #2232 .

tusharpandey13 avatar Jul 25 '25 14:07 tusharpandey13