When I try to login this is the result, but before my login is working properly. I have also User data collection but I already set the permission who can read.
role:guests means you're not logged in. Can you provide more detail about what you're doing and what's going on?
I am trying to login my account
@override
Future<UserProfile> signInWithEmailAndPassword({
required String email,
required String password,
}) async {
try {
await account.createEmailSession(
email: email,
password: password,
);
return currentUser;
} on AppwriteException catch (e, stacktrace) {
_logger.severe(
'Failed to sign in user with email: $email',
e,
);
throw LoginException(
e.message ?? 'Failed to sign in user with email: $email',
stackTrace: stacktrace,
provider: AuthProvider.email,
);
} catch (e, stacktrace) {
_logger.severe(
'Failed to sign in user with email: $email',
e,
);
throw LoginException(
e.toString(),
stackTrace: stacktrace,
provider: AuthProvider.email,
);
}
}
Future<UserProfile> get currentUser async {
_logger.info('Getting current user');
try {
final user = await account.get();
_logger.info('Got current user');
final userProfile = await getUserProfile(userId: user.$id);
return userProfile.copyWith(
data: user,
);
} on AppwriteException catch (e, stacktrace) {
_logger.warning('Failed to get current user', e);
throw AuthException(
e.message ?? 'No user signed in',
stackTrace: stacktrace,
);
} catch (e, stacktrace) {
_logger.severe('Failed to get current user', e);
throw AuthException(
e.toString(),
stackTrace: stacktrace,
);
}
}
@override
Future<UserProfile> getUserProfile({required String userId}) async {
try {
final response = await databases.getDocument(
databaseId: userCredential.databaseId,
collectionId: userCredential.collectionId,
documentId: userId,
);
return UserProfile.appwriteParse(response.data);
} on AppwriteException catch (e, stackTrace) {
_logger.severe(
'''
Failed to get the user information for user $userId''',
e,
stackTrace,
);
throw ProfileUpdateException(
'''
Failed to get the user information for user $userId''',
stackTrace: stackTrace,
);
}
This was my firsst time to encounter this error, Before my login page is working properly
@Mosh Ontong Hmmm I would take a look at if the login failed for some reason
π Did the create session request also fail?
I observe that earlier the login is executed successfully I can see the user session in auth page of appwrite console
Since my method returning a user credential collection. I set the permission to any
so I can test if the collection is the root cause
but still I am receiving this error
Now I refactor my method, I am now returning a account.get(); and I receive this error
I am not familiar with this error
btw I am using flutter
I think we have same issue
I always received this exception:
Flutter web?
flutter window
I found that in my auth console it actually created a session after login
So basicayll if I hot reload my flutter app, it will check first if the user is authenticated by using account.get
Recommended threads
- Invalid type for attribute 'email': emai...
I'm using the node-appwrite SDK to create a table, the column payload looks like this: ```json [{"key":"email","type":"email","required":true, "size": 512}] ``...
- Auth not working
guys my appwrite auth isnt working? oauth works (Sign in with google n discord) i have 2 websites deployed where do i get help when i do sign in with email and ...
- Issue related to index
Why it is showing this error?