Skip to content

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

Open
TomikeDS wants to merge 1 commit into
ChainForgee:mainfrom
TomikeDS:fix/jwt-auth-wiring-api-client
Open

fix: wire JWT bearer auth into the typed API client#439
TomikeDS wants to merge 1 commit into
ChainForgee:mainfrom
TomikeDS:fix/jwt-auth-wiring-api-client

Conversation

@TomikeDS

Copy link
Copy Markdown

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
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

1 participant