Skip to content

fix: address API resource server test report issues - #14

Merged
yogeshchoudhary147 merged 2 commits into
mainfrom
fix/api-bug-fixes
Aug 24, 2026
Merged

fix: address API resource server test report issues#14
yogeshchoudhary147 merged 2 commits into
mainfrom
fix/api-bug-fixes

Conversation

@yogeshchoudhary147

@yogeshchoudhary147 yogeshchoudhary147 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • API-001: requireClaims and requireClaimsFromContext now throw Response objects (401/403 JSON) instead of BearerTokenError/InsufficientScopeError Error instances. React Router forwards thrown Response objects directly to the client as HTTP responses; thrown Error instances fall into the error boundary and produce a 500. Aligns behavior with requireSession.
  • API-002/003: Added a dedicated "API resource server" section to the README covering requireClaims, getClaims, bearerTokenMiddleware, correct Auth0 Dashboard setup (PKCE user flows require user.policy: allow_all on the resource server — not the M2M Applications tab), and claims.aud string vs string[] handling.

Test plan

  • requireClaims with no Authorization header → 401 JSON { error: "bearer_token_error" }
  • requireClaims with invalid token → 401 JSON with underlying error message
  • requireClaims with missing scope → 403 JSON { error: "insufficient_scope" }
  • requireClaimsFromContext with null claims in context → 401 Response
  • requireClaimsFromContext with missing scope → 403 Response
  • ConfigurationError (missing AUTH0_DOMAIN/AUTH0_AUDIENCE) still propagates as-is (not swallowed)
  • All existing tests pass: npm test

@yogeshchoudhary147 yogeshchoudhary147 changed the title fix: API resource server — correct HTTP response types and Auth0 setup docs fix: address API resource server test report issues Aug 24, 2026

@Piyush-85 Piyush-85 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yogeshchoudhary147
yogeshchoudhary147 merged commit 0cabbcd into main Aug 24, 2026
4 checks passed
@yogeshchoudhary147
yogeshchoudhary147 deleted the fix/api-bug-fixes branch August 24, 2026 05:57
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.

2 participants