Session sign-out and sign-back-in issues with records from the database
- 0
- Databases
- Flutter
- Auth
- Cloud
Session sign-out and sign-back-in issues with records from the database
In a Flutter application I am testing signing a user in, you can see the user’s records. Sign out and Sign back in. The user’s records do not show. But if you close the app or refresh the app in the simulator, the data shows up. I am testing with an iOS Simulator and iOS Device with the same results
I traced the database queries and they are being executed.
I traced the session and it’s removed, and then the correct session gets set again. It’s like the Database queries still think the session is not there, but the trace shows the correct session.
Sign out:
Future<void> signOut() async {
if (_currentUser == null || _currentSession == null) {
print('signOut error: User is not authenticated');
return;
}
try {
// Delete all sessions
// await _account.deleteSession(sessionId: 'current');
final result = await _account.deleteSessions();
print('signOut result: $result');
_currentUser = null;
_currentSession = null;
_authStateController.add(null);
print('signOut success');
} catch (e) {
print('signOut error: $e');
}
}
Sign in:
Future<Session?> signInWithEmailAndPassword({
required String email,
required String password,
}) async {
try {
// Create a new session
final Session session = await _account.createEmailPasswordSession(
email: email,
password: password,
);
debugPrint('signInWithEmailAndPassword: ${session.userId}');
_currentUser = await getCurrentUser();
_currentSession = session;
_authStateController.add(session);
return session;
} on AppwriteException catch (e) {
debugPrint('signInWithEmailAndPassword error 1: $e');
return null;
}
}
Any thoughts?
Recommended threads
- MongoDb Database Breaks integer[] & bigi...
I've got a table with the below column created. When I try to insert the value `[-3408048000]` into it, the dart sdk cloud function call is successful (no error...
- Missing Invoice
Hi! I need help with billing on my account (marelu@gmail.com). I have never received a single invoice by email. My organization has been on the Pro plan since...
- Appwrite Functions cold start
Hello. I'm seeing really long cold starts on Appwrite Cloud Functions and wanted to know if this is expected. My function just authenticates the user, fetches ...