[SOLVED] 400 Invalid Email: Value must be a valid email address
- 0
- Resolved
- Users
- Accounts
- Flutter
For some device when creating new account it showing this error for some device. Even though the email is valid.
400 Invalid Email: Value must be a valid email address
Could you share the code where you're creating the new account?
class AuthenticationHelper implements AuthenticationBase {
final logger = Logger('AuthenticationHelper');
final Account account;
AuthenticationHelper(this.account);
@override
Future<AuthenticationResponse> createAccount({
required String email,
required String password,
required String? userName,
}) async {
try {
final user = await account.create(
userId: UuidHelper.userID(),
email: email,
password: password,
name: userName,
);
// return AuthenticationResponse.success(user: user);
return await login(email: user.email, password: password);
} on AppwriteException catch (e) {
return AuthenticationResponse.failure(exception: e);
}
}
@override
Future<AuthenticationResponse> login(
{required String email, required String password}) async {
try {
final session =
await account.createEmailSession(email: email, password: password);
final user = await account.get();
return AuthenticationResponse.success(
user: user,
message:
'Logged in as ${user.name} successfully. Session: ${session.ip}',
);
} on AppwriteException catch (e) {
return AuthenticationResponse.failure(exception: e);
}
}
}
okay this seems fine. do you mind sharing the code where you call the login/signup functions?
onPressed: loading
? null
: () {
final valid = formKey.currentState?.validate();
final emailExtention = ref.read(emailExtentionProvider);
final department = ref.read(whatDepartmentProvider);
final email = this.email.trim() + emailExtention;
if (valid ?? false) {
ref.read(authenticationServiceProvider.notifier).createAccount(
email: email,
password: password,
userName:
'${department?.value.substring(0, 1)}$studentId',
);
}
},
Weird. I cannot find any mistake in your code.
Have you tried checking DevTools to see what happens when you call the functions?
I manually check the code multiple times but could not figure it out. This problem happing for some devices. Today I open the app for beta testing and 30 to 40% users facing this problem. Even though the code looks right.
Yes But not issue found for my end. Working well on my simulator and my real device
are you using appwrite cloud? or a self-hosted instance?
self hosting.
I'm honestly not sure what might be causing this. I suggest waiting for a developer to comment.
Okay
Why you're login after registration?
That's not needed
Try deleting that
Also try doing print(email) just after the function that supposedly is giving an error to see what does the email field contains
Send here what's de email field result
Okay. I got the problem. It was for the textEditingController listener problem. Thanks
[SOLVED] 400 Invalid Email: Value must be a valid email address
Recommended threads
- executeFunction intermittently throws Fo...
Environment: Flutter app using the Appwrite Flutter SDK, calling executeFunction for [describe endpoint, e.g. live-stream-related function]. *Description*: Int...
- How to update from 1.8.1 to 1.9.6
Due to the number of issues reported in version 1.9.5, I am hesitant to proceed with the update. Could anyone advise if version 1.9.6 is stable and resolves tho...
- HTTP Error 500 ''
Hello to everyone, I'm a Flutter developer and actually I'm developing an app using Appwrite.. during my tests and also massive ones I've noticed something we...