storeSession method
Stores user session data
Implementation
Future<void> storeSession(String userId, String accessToken) async {
try {
final sessionData = {
'userId': userId,
'accessToken': accessToken,
'timestamp': DateTime.now().toIso8601String(),
'provider': 'cognito',
};
// In a real implementation, this would store to secure storage
// For now, we'll just store in memory or temporary file
final directory = Directory(_sessionDir);
if (!await directory.exists()) {
await directory.create(recursive: true);
}
final file = File('$_sessionDir/$_sessionFile');
await file.writeAsString(json.encode(sessionData));
print('Cognito session stored for user: $userId');
} catch (e) {
print('Failed to store session: $e');
throw DSAuthError('Failed to store session');
}
}