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
- Query multi-tenant db with $permissions ...
I'm setting up a multi-tenant database with RLS enabled. My users my have permissions set for multiple Teams, and as such when they query the database with the ...
- All projects deleted
Hello, from the appwrite console last week I re-activated some of my old project and published them, yesterday I checked and none of the apps were working, now ...
- Realtime: Listener not triggered on upda...
I self host appwrite 1.8.1. The genereal functionallity works fine. But my realtime subscription isn't updating. I see "Received heartbeat response from realtim...