Implement Auth0 migration

This commit is contained in:
gpt-engineer-app[bot]
2025-11-01 01:08:11 +00:00
parent 858320cd03
commit b2bf9a6e20
17 changed files with 1430 additions and 7 deletions

101
src/types/auth0.ts Normal file
View File

@@ -0,0 +1,101 @@
/**
* Auth0 Type Definitions
*/
import type { User } from '@auth0/auth0-react';
/**
* Extended Auth0 user with app-specific metadata
*/
export interface Auth0User extends User {
app_metadata?: {
roles?: string[];
supabase_id?: string;
migration_status?: 'pending' | 'completed' | 'failed';
};
user_metadata?: {
username?: string;
display_name?: string;
avatar_url?: string;
};
}
/**
* Auth0 MFA enrollment status
*/
export interface Auth0MFAStatus {
enrolled: boolean;
methods: Array<{
id: string;
type: 'totp' | 'sms' | 'push' | 'email';
name?: string;
confirmed: boolean;
}>;
}
/**
* Auth0 role information
*/
export interface Auth0RoleInfo {
id: string;
name: string;
description?: string;
}
/**
* Auth0 sync status for migration tracking
*/
export interface Auth0SyncStatus {
auth0_sub: string;
supabase_id?: string;
last_sync: string;
sync_status: 'success' | 'pending' | 'failed';
error_message?: string;
}
/**
* Auth0 authentication state
*/
export interface Auth0State {
isAuthenticated: boolean;
isLoading: boolean;
user: Auth0User | null;
accessToken: string | null;
idToken: string | null;
needsMigration: boolean;
isAuth0User: boolean;
}
/**
* Auth0 Management API token response
*/
export interface ManagementTokenResponse {
access_token: string;
token_type: string;
expires_in: number;
}
/**
* Auth0 user sync request
*/
export interface UserSyncRequest {
auth0_sub: string;
email: string;
name?: string;
picture?: string;
email_verified: boolean;
}
/**
* Auth0 user sync response
*/
export interface UserSyncResponse {
success: boolean;
profile?: {
id: string;
auth0_sub: string;
username: string;
email: string;
};
error?: string;
}