mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 15:11:13 -05:00
Implement Auth0 migration
This commit is contained in:
101
src/types/auth0.ts
Normal file
101
src/types/auth0.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user