Skip to content

fix: wire JWT bearer auth into the typed API client - #439

Merged
kilodesodiq-arch merged 2 commits into
ChainForgee:mainfrom
TomikeDS:fix/jwt-auth-wiring-api-client
Aug 20, 2026
Merged

fix: wire JWT bearer auth into the typed API client#439
kilodesodiq-arch merged 2 commits into
ChainForgee:mainfrom
TomikeDS:fix/jwt-auth-wiring-api-client

Conversation

@TomikeDS

Copy link
Copy Markdown
Contributor

Summary

The api-client attached no auth header and documented the obsolete x-api-key model. Every request to a JWT-protected endpoint failed with 401 unless callers manually rolled token attachment.

This adds a token-store (setToken/getToken), a token-aware fetch wrapper that attaches Authorization: Bearer on every request, and a single-flight refresh-on-401 path. The stale x-api-key comment is replaced with JWT guidance.

Closes #433

Testing

  • Verified token-store stores/retrieves/clears tokens
  • Verified setOnTokenRefresh/resetOnTokenRefresh work correctly
  • Verified existing tests still pass

Checklist

  • Tests added or updated for new/changed behavior
  • Existing tests pass
  • No secrets, keys, or seed phrases committed
  • Follows the coding conventions in the relevant service README
  • PR is focused on a single concern

The api-client attached no auth header and documented the obsolete
x-api-key model.  Every request to a JWT-protected endpoint failed
with 401 unless callers manually rolled token attachment.

This adds a token-store (setToken/getToken), a token-aware fetch
wrapper that attaches Authorization: Bearer <token> on every
request, and a single-flight refresh-on-401 path.  The stale
x-api-key comment is replaced with JWT guidance.

Closes ChainForgee#433
… failure

The @sentry/nextjs package is not installed as a dependency but was
imported in the error boundary component, causing TS2307 type-check
failure in Frontend CI.

@kilodesodiq-arch kilodesodiq-arch left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kilodesodiq-arch
kilodesodiq-arch merged commit 79a52f4 into ChainForgee:main Aug 20, 2026
5 checks passed
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.

typed API client ships no JWT auth wiring: every generated route that requires a valid JWT token returns 401

2 participants