storeSession method

Future<void> storeSession(
  1. String userId,
  2. String accessToken
)

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': 'entraid',
    };

    // 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('Entraid session stored for user: $userId');
  } catch (e) {
    print('Failed to store session: $e');
    throw DSAuthError('Failed to store session');
  }
}