Skip to content

Add Authorization header to Reader Revenue /header request#15462

Open
juabara wants to merge 2 commits intomainfrom
jm/feat-mparticle-headers
Open

Add Authorization header to Reader Revenue /header request#15462
juabara wants to merge 2 commits intomainfrom
jm/feat-mparticle-headers

Conversation

@juabara
Copy link
Contributor

@juabara juabara commented Mar 3, 2026

What

This PR updates the TopBarSupport component to send the user's Authorization token when fetching the Reader Revenue header if they are signed in.

Why

To allow the /header endpoint on the contributions service to authenticate the user and return appropriate personalized header content (e.g., hiding support messaging for supporters, or showing specific sign-in/supporter prompts).

Changes:

  • src/lib/sdcRequests.ts: Updated the getHeader signature to accept an optional headers?: HeadersInit argument and pass it down to getModuleData.
  • src/components/TopBarSupport.importable.tsx:
    • Replaced the external getHeader import from @guardian/support-dotcom-components with our local implementation to allow passing custom headers.
    • Replaced useIsSignedIn() with useAuthStatus() to access the full authentication state, including the access token.
    • Passed the computed Authorization headers (via getOptionsHeaders) into the getHeader fetch request when authStatus.kind === 'SignedIn'.

@juabara juabara added the feature Departmental tracking: work on a new feature label Mar 3, 2026
@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Hello 👋! When you're ready to run Chromatic, please apply the run_chromatic label to this PR.

You will need to reapply the label each time you want to run Chromatic.

Click here to see the Chromatic project.

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Departmental tracking: work on a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant