There is an error am getting when I sign my apk and share it to my users when they try to sign up it appears yet in emulator it doesn't appear, below is my view model code,
TypeScript
class AuthViewModel(private val client: Client) : ViewModel() {
private val account by lazy { Account(client) }
private val _authState = MutableStateFlow<AuthState>(AuthState.Initial)
val authState = _authState.asStateFlow()
fun signUpWithEmail(email: String, password: String, name: String) {
viewModelScope.launch {
_authState.value = AuthState.Loading
try {
if (!android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
_authState.value = AuthState.Error("Please enter a valid email address")
return@launch
}
account.create(
userId = ID.unique(),
email = email,
password = password,
name = name
)
signInWithEmail(email, password)
} catch (e: Exception) {
val errorMessage = when {
e.message?.contains("already exists") == true -> "Email already registered"
e.message?.contains("password") == true -> "Password must be at least 8 characters"
else -> "Unable to create account: ${e.message}"
}
_authState.value = AuthState.Error(errorMessage)
}
}
}
}```
TL;DR
Error occurs when signing the APK and sharing it with users for sign up, but not evident in the emulator. The issue could be due to invalid email format, pre-existing email, or insufficient password length. Ensure proper error handling and validation to prevent the error from appearing.Recommended threads
- User columns stuck on processing
Hi — on Appwrite Cloud (Free), Project ID 69d7dd8200098ed8560c, database mylestone-db. Attributes/columns are stuck in "processing" indefinitely across two coll...
- [1.9.5] Google OAuth do not work anymore
After migrating to 1.8.1 to 1.9.0 then 1.9.5 and login through Google I get on Flutter app "Missing redirect URL" "Your OAuth login flow is missing a proper re...
- 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 ...