Skip to content

refactor: move auth to main#1360

Open
jonathanlab wants to merge 8 commits intomainfrom
03-30-refactor_move_auth_to_main
Open

refactor: move auth to main#1360
jonathanlab wants to merge 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 95069b4 to c0bb295 Compare March 31, 2026 11:50
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.

2 participants