fix: sign For You feed request to fix 403 from discovery#14300
fix: sign For You feed request to fix 403 from discovery#14300dylanjeffers wants to merge 1 commit into
Conversation
The OpenAPI spec for `/v1/users/{id}/feed/for-you` omits the
`Encoded-Data-Message`/`Encoded-Data-Signature` header parameters that
the analogous `/v1/users/{id}/feed` endpoint declares, so the generated
SDK method has no auth-header handling. In the For You query flow this
manifested as the discovery node returning 403 with `authedWallet=`
empty — the request was reaching the server unsigned.
Sign in the hook using `sdk.services.audiusWalletClient` and pass the
headers via `initOverrides`. The request-signature middleware sees the
headers already present and skips its own injection, so there's no
double-signing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
🌐 Web preview readyPreview URL: https://audius-web-preview-pr-14300.audius.workers.dev Unique preview for this PR (deployed from this branch). |
|
Closing — fixing this on the API side instead. The root cause was the global API fix: AudiusProject/api#804 — exempts Reverting the client-side patch keeps |
Summary
The For You feed on web RC was returning empty / blank because the discovery-node request was reaching the server unsigned, getting back
403 "You are not authorized to make this request authedWallet= myId=<N>".Root cause
The OpenAPI swagger spec for
/v1/users/{id}/feed/for-youis missing theEncoded-Data-MessageandEncoded-Data-Signatureheader parameters that the analogous/v1/users/{id}/feedendpoint declares. Compare the generated SDK methods:getUserFeedRawreadsparams.encodedDataMessage/params.encodedDataSignatureintoheaderParametersbefore callingthis.request(...)— these match what the addRequestSignatureMiddleware would inject, so the headers are always present.getUserForYouFeedRawhas no auth-header handling at all — relies entirely on middleware-injected headers.The signing middleware (
addRequestSignatureMiddleware) is supposed to populate those headers at request time, and should apply to both endpoints since both callthis.request(). In practice the For You call is going out without them — symptom verified by the 403 response with emptyauthedWallet=.Rather than chase the middleware behavior, this PR signs explicitly at the call site so the headers are guaranteed present.
What changed
packages/common/src/api/tan-query/lineups/useForYouFeed.ts: sign withsdk.services.audiusWalletClient.signMessageand passEncoded-Data-Message/Encoded-Data-Signaturevia the SDK method'sinitOverrides. The request-signature middleware sees the headers already present and skips its injection — no double-signing.Test plan
release-candidate.audius.co(signed in), open For You tab and verify it loads tracks instead of showing empty / skeleton state.GET /v1/users/{id}/feed/for-yourequest — confirmEncoded-Data-MessageandEncoded-Data-Signatureheaders are present, and response is 200 with track data.Follow-ups (not in this PR)
/feed/for-youshould declare theEncoded-Data-*header parameters so the next SDK regenerate brings the generated method in line withgetUserFeedRaw. Once that lands, this hook-level patch can be reverted.staging.audius.cois serving a Dec 2025 build because the staging deploy pipeline was retired (Drop staging #13540) but DNS still points at the orphaned worker. Worth tombstoning or redirecting separately.🤖 Generated with Claude Code