// Identity selection page (/auth/select-identity). // // Reached after a successful OAuth login when no existing git-bug identity // could be matched automatically (via provider metadata set by the bridge). // The user can either adopt an existing identity — which links it to their // OAuth account for future logins — or create a fresh one from their OAuth // profile. import { useEffect, useState } from 'react' import { UserCircle, Plus, AlertCircle } from 'lucide-react' import { Button } from '@/components/ui/button' import { Skeleton } from '@/components/ui/skeleton' interface IdentityItem { repoSlug: string id: string humanId: string displayName: string login?: string avatarUrl?: string } export function IdentitySelectPage() { const [identities, setIdentities] = useState(null) const [error, setError] = useState(null) const [working, setWorking] = useState(false) useEffect(() => { fetch('/auth/identities', { credentials: 'include' }) .then((res) => { if (!res.ok) throw new Error(`unexpected status ${res.status}`) return res.json() as Promise }) .then(setIdentities) .catch((e) => setError(String(e))) }, []) async function adopt(identityId: string | null) { setWorking(true) try { const res = await fetch('/auth/adopt', { method: 'POST', credentials: 'include', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(identityId ? { identityId } : {}), }) if (!res.ok) throw new Error(`adopt failed: ${res.status}`) // Full page reload to reset Apollo cache and auth state cleanly. window.location.assign('/') } catch (e) { setError(String(e)) setWorking(false) } } return (

Choose your identity

No git-bug identity was found linked to your account. Select an existing identity to link it, or create a new one from your profile.

{error && (
{error}
)} {!identities && !error && (
{Array.from({ length: 3 }).map((_, i) => ( ))}
)}
{identities?.map((id) => (

{id.displayName}

{id.login ? `@${id.login} · ` : ''}{id.repoSlug} · {id.humanId}

))} {/* Always offer to create a new identity */}

Create new identity

A fresh git-bug identity will be created from your OAuth profile.

) }