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
- Function connected custom domain error: ...
My domain is served through Cloudflare. Domain is now connected with the appwrite function. But when accessing the domain, I get the below error. Any suggestion...
- Error | general_unknown
I have built a website using Appwrite Cloud as backend, and also using sites for deployment. My website is live but sometimes it shows Appwrite's Error general_...
- Introducing new string column types made...
Adding new string types is hugely bennificial! Unfortunately it made the current column types not editable to change their types to the new longer field types.