fix(auth): skip Flutter OIDC on web, rely on NPM forward auth
On web, NPM forward auth handles authentication at the proxy level. By the time the Flutter app loads, the user is already authenticated. Skip the redundant Flutter OIDC flow that was causing Riverpod "Ref disposed" errors from conflicting auth state updates. Mobile still uses Flutter's OIDC flow as before. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
790ae41171
commit
f0b32ff68b
@@ -1,3 +1,4 @@
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
@@ -45,6 +46,14 @@ class _AppScaffoldState extends ConsumerState<AppScaffold> {
|
||||
return _buildScaffold(context);
|
||||
}
|
||||
|
||||
// On web, NPM forward auth handles authentication at the proxy level.
|
||||
// If we reach this point, the user is already authenticated by NPM.
|
||||
// No need for Flutter's OIDC flow - just show the app.
|
||||
if (kIsWeb) {
|
||||
return _buildScaffold(context);
|
||||
}
|
||||
|
||||
// Mobile: Use Flutter's OIDC flow
|
||||
final authAsync = ref.watch(authProvider);
|
||||
|
||||
return authAsync.when(
|
||||
|
||||
Reference in New Issue
Block a user