L'authentification Keycloak WebView est maintenant 100% fonctionnelle avec navigation automatique vers le dashboard !

This commit is contained in:
DahoudG
2025-09-19 13:03:09 +00:00
parent 098894bdc1
commit 4ac376b7e7
4 changed files with 53 additions and 31 deletions

View File

@@ -73,11 +73,16 @@ class _LoginPageState extends State<LoginPage>
builder: (context) => KeycloakWebViewAuthPage(
onAuthSuccess: (user) {
debugPrint('✅ Authentification réussie pour: ${user.fullName}');
// Notifier le BLoC du succès
context.read<AuthBloc>().add(AuthWebViewCallback('success'));
// Fermer la WebView et naviguer vers le dashboard
debugPrint('🔄 Notification du BLoC avec les données utilisateur...');
// Notifier le BLoC du succès avec les données utilisateur
context.read<AuthBloc>().add(AuthWebViewCallback(
'success',
user: user,
));
// Fermer la WebView - la navigation sera gérée par le BlocListener
Navigator.of(context).pop();
Navigator.of(context).pushReplacementNamed('/dashboard');
},
onAuthError: (error) {
debugPrint('❌ Erreur d\'authentification: $error');

View File

@@ -117,11 +117,13 @@ class VisitorDashboard extends StatelessWidget {
children: [
const Icon(Icons.info_outline, color: Colors.white, size: 30),
const SizedBox(width: SpacingTokens.sm),
Text(
'Découvrez notre communauté',
style: TypographyTokens.headlineMedium.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
Expanded(
child: Text(
'Découvrez notre communauté',
style: TypographyTokens.headlineMedium.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
],