loginWithSessionId method
Logs in user and stores in specific session
user The user to log in
sessionId The session ID to store user in
Returns authentication response
Implementation
Future<AuthResponse> loginWithSessionId(
Authenticatable user,
String sessionId,
) async {
// Generate tokens using driver
final authResponse = await driver.generateTokens(user);
var activeSessionId = sessionId;
// Store user ID in session
if (_sessionManager != null) {
activeSessionId = await _sessionManager.regenerateSession(sessionId);
await _storeUserInSessionById(activeSessionId, user.getAuthIdentifier());
}
return _withSessionMetadata(
authResponse,
activeSessionId,
sessionRegenerated: _sessionManager != null,
);
}