Skip to content

refactor: move auth to main#1360

Merged
jonathanlab merged 8 commits intomainfrom
03-30-refactor_move_auth_to_main
Apr 1, 2026
Merged

refactor: move auth to main#1360
jonathanlab merged 8 commits intomainfrom
03-30-refactor_move_auth_to_main

Conversation

@jonathanlab
Copy link
Copy Markdown
Contributor

@jonathanlab jonathanlab commented Mar 30, 2026

Problem

We have a lot of transient auth issues which are hard to debug. The auth store is a giant 1000 line monolith. It handles auth, oauth, onboarding, project switching etc. We're passing the auth token by value instead of reference throughout the entire repository. Improving this setup could fix some of the issues, or at least makes them easier to debug.

Changes

This is the first PR in the auth refactor, and mostly scaffolds stuff:

  • Move the auth logic to a service in main.
  • Added a table for storing auth sessions
  • Changed boot order so that auth starts before window creation
  • Renderer auth store no longer persists auth/handles refresh
  • Auth store is now a temporary wrapper around the new main service
  • PostHogAPIClient now asks main for a valid token instead of storing it locally

We will replace all usages of the auth store TRPC queries later on.
This PR breaks several things:

  • Token handling in main
  • Onboarding persistence

These are added back in later PRs in the stack, to keep this PR somewhat readable.

Copy link
Copy Markdown
Contributor Author

jonathanlab commented Mar 30, 2026

@jonathanlab jonathanlab force-pushed the 03-30-refactor_move_auth_to_main branch from c0bb295 to ba27f7f Compare March 31, 2026 13:44
Copy link
Copy Markdown
Contributor Author

jonathanlab commented Apr 1, 2026

Merge activity

  • Apr 1, 9:59 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Apr 1, 10:00 AM UTC: @jonathanlab merged this pull request with Graphite.

@jonathanlab jonathanlab merged commit ae1b192 into main Apr 1, 2026
17 checks passed
@jonathanlab jonathanlab deleted the 03-30-refactor_move_auth_to_main branch April 1, 2026 10:00
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.

3 participants