Skip to content

chore: return a 204 from the profile endpoint when unauthenticated #2159

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

guabu
Copy link
Contributor

@guabu guabu commented Jun 10, 2025

📋 Changes

This PR adds a noContentProfileResponseWhenUnauthenticated configuration option to return a 204 No Content response from the profile endpoint when the user is not authenticated. This avoids undesirable few cases:

📎 References

Relevant issue: #1933

🎯 Testing

  • PR includes tests for the useUser() hook and server components
  • A sample repository for testing can also be found in the issue linked above

@guabu guabu requested a review from a team as a code owner June 10, 2025 17:45
@guabu guabu force-pushed the profile-endpoint-empty-body branch from e33a397 to 68b3239 Compare June 10, 2025 19:02
@frederikprijck
Copy link
Member

Approved as this also aligns more again with v3 as per #791

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.77%. Comparing base (3e5fa12) to head (791a9ba).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2159      +/-   ##
==========================================
+ Coverage   82.66%   82.77%   +0.10%     
==========================================
  Files          21       21              
  Lines        2060     2072      +12     
  Branches      362      367       +5     
==========================================
+ Hits         1703     1715      +12     
  Misses        350      350              
  Partials        7        7              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v4: useUser/Auth0Provider loses Basic Auth credentials
3 participants