Skip to content

Add auth token propagation for Poetic Brain chat#326

Open
DHCross wants to merge 1 commit intomainfrom
codex/fix-missing-load-last-report-button-and-auth-issue
Open

Add auth token propagation for Poetic Brain chat#326
DHCross wants to merge 1 commit intomainfrom
codex/fix-missing-load-last-report-button-and-auth-issue

Conversation

@DHCross
Copy link
Owner

@DHCross DHCross commented Dec 4, 2025

Summary

  • persist Auth0 status and access tokens for chat sessions so Math Brain payloads resolve to the right user scope
  • attach stored bearer tokens to Poetic Brain API requests to satisfy allowlist authentication

Testing

  • Not run (not requested)

Codex Task

@netlify
Copy link

netlify bot commented Dec 4, 2025

Deploy Preview for sprightly-genie-998c07 failed. Why did it fail? →

Name Link
🔨 Latest commit 3520a09
🔍 Latest deploy log https://app.netlify.com/projects/sprightly-genie-998c07/deploys/693100d5cffb740008eb24f6

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +209 to +212
const token = getAuthToken();
if (token) {
headers.Authorization = `Bearer ${token}`;
}

Choose a reason for hiding this comment

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

P1 Badge Refresh auth tokens before Raven requests

The Authorization header for every Raven call is populated from whatever value happens to be in localStorage (getAuthToken), but that token is only fetched once during the initial Auth0 bootstrap in RequireAuth (lines 111‑130) and is never refreshed. Auth0 access tokens expire (typically ~1h) and app/api/raven/route.ts rejects expired tokens via verifyToken, so any user who keeps the chat open past the token lifetime will start getting 401s even though the UI still marks them as authenticated. Without re‑calling getTokenSilently or another refresh path before setting this header, long-running sessions will break until the page is reloaded.

Useful? React with 👍 / 👎.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant