fix(auth): ensure token storage before user state updates
- Store authentication tokens explicitly before setting user state in login and TOTP verification flows to prevent race conditions - Add 'credentials: include' to WebAuthn endpoints for proper session cookie handling - Add comprehensive debug logging throughout authentication flow to trace token lifecycle and API requests - Update WebAuthn completeLogin to use fetch directly instead of request helper to properly handle session cookies - Add allowedHosts configuration to Vite dev server
This commit is contained in:
@@ -85,14 +85,18 @@ export default function ProfilePage() {
|
||||
|
||||
// Fetch organizations only when user is available
|
||||
useEffect(() => {
|
||||
console.log('[ProfilePage] useEffect triggered, user:', user?.id);
|
||||
if (!user) {
|
||||
console.log('[ProfilePage] No user, skipping organizations fetch');
|
||||
setOrgsLoading(false);
|
||||
return;
|
||||
}
|
||||
|
||||
const fetchOrgs = async () => {
|
||||
console.log('[ProfilePage] Making api.users.organizations() request');
|
||||
try {
|
||||
const response = await api.users.organizations();
|
||||
console.log('[ProfilePage] Organizations fetched successfully:', response.organizations.length);
|
||||
setOrganizations(response.organizations);
|
||||
} catch (error) {
|
||||
if (error instanceof ApiError) {
|
||||
|
||||
Reference in New Issue
Block a user