Store OIDC code_verifier and state in sessionStorage instead of static memory variables. This fixes the "No code verifier" error that occurred after Authentik redirect because the Flutter app restarts and loses in-memory state. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
836 B
Dart
35 lines
836 B
Dart
/// Web-specific utilities for browser operations.
|
|
library;
|
|
|
|
import 'package:web/web.dart' as web;
|
|
|
|
/// Redirect the browser to a URL.
|
|
void redirectTo(String url) {
|
|
web.window.location.href = url;
|
|
}
|
|
|
|
/// Get the current browser URL.
|
|
String getCurrentUrl() {
|
|
return web.window.location.href;
|
|
}
|
|
|
|
/// Replace the current URL in history without navigation.
|
|
void replaceUrl(String url) {
|
|
web.window.history.replaceState(null, '', url);
|
|
}
|
|
|
|
/// Store a value in sessionStorage.
|
|
void setSessionStorage(String key, String value) {
|
|
web.window.sessionStorage.setItem(key, value);
|
|
}
|
|
|
|
/// Get a value from sessionStorage.
|
|
String? getSessionStorage(String key) {
|
|
return web.window.sessionStorage.getItem(key);
|
|
}
|
|
|
|
/// Remove a value from sessionStorage.
|
|
void removeSessionStorage(String key) {
|
|
web.window.sessionStorage.removeItem(key);
|
|
}
|