Skip to content

refactor(hub-client): AuthProvider interface for GIS coupling#219

Merged
shikokuchuo merged 1 commit into
mainfrom
refactor/auth-provider-interface
May 20, 2026
Merged

refactor(hub-client): AuthProvider interface for GIS coupling#219
shikokuchuo merged 1 commit into
mainfrom
refactor/auth-provider-interface

Conversation

@shikokuchuo
Copy link
Copy Markdown
Member

Why

  • Preparation for a second IdP backend. Today @react-oauth/google is imported across five production files; with a second backend that becomes ten. A thin interface caps the blast radius — adding another provider later means writing one file and swapping one factory call in main.tsx.
  • noopAuthProvider instead of AuthProvider | null because every alternative forced consumers to branch (provider?.useSilentRenewal(...) is also a conditional hook call, which react-hooks/rules-of-hooks flags).

What

  • Introduce AuthProvider interface (sign-in button, silent renewal, signout) consumed via React context.
  • LoginScreen, useAuth, authService, main.tsx no longer import @react-oauth/google directly — only auth/GoogleAuthProvider.tsx and main.tsx's SDK-loader wrap do.
  • Auth-disabled mode (VITE_GOOGLE_CLIENT_ID unset) modelled by noopAuthProvider; consumers don't branch on null.
  • No behaviour change. Plan: claude-notes/plans/2026-05-20-auth-provider-interface.md.

Introduce an `AuthProvider` interface (sign-in button, silent renewal,
signout). `LoginScreen`, `useAuth`, `authService`, and `main.tsx`
depend on it via React context; only `auth/GoogleAuthProvider.tsx` and
`main.tsx` import `@react-oauth/google` directly. Auth-disabled mode
uses a `noopAuthProvider` so consumers never branch on null. No
behaviour change. Plan:
`claude-notes/plans/2026-05-20-auth-provider-interface.md`.
@shikokuchuo shikokuchuo merged commit ace38a0 into main May 20, 2026
5 checks passed
@shikokuchuo shikokuchuo deleted the refactor/auth-provider-interface branch May 20, 2026 13:52
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.

1 participant