7. **Sync wiring**: the sync is triggered from the `auth.jwt` filter, which fires on login and on every session refresh (~once a day per active tab) - `auth.login` alone would never re-sync a permanently logged-in user. It runs in the background: the token is issued immediately, a failure is only logged, the next login/refresh retries. Syncs on every login and refresh; concurrent syncs of the same user are safe - the unique keys catch the races. The sync-github-data endpoint (manual button) also runs `syncOrganizations` and shows the error to the user. A separate sign-up sync is not needed: the first login emits `auth.jwt` too. The same filter stamps the session claims - `user_type`, `github_username` and, from now on, `user_account_id`: the user's own account, which is what a session bills unless it is switched to an org. It ships here because phase 2 has no Directus deploy; the readers keep a lookup as a fallback for the sessions issued before this, which stay valid for a day.
0 commit comments