I’m testing a scenario in which a user who tried to sign up with their email but never confirmed it then tries to log in. Previously the error I got in this case was “confirmation required”, but now instead I’m getting “unauthorized”. This happens whether I print the error itself or the localized description. Strangely though, in the server logs, it shows correctly as “confirmation required”. This creates a confusing user experience. I’ve even tried deleting and recreating the app service but I’m still getting the same behavior.
func attemptEmailLogIn() {
updateCredentialsError(forExistingUser: true)
if errorMessage == nil {
Task {
do {
let _ = try await app.login(credentials: Credentials.emailPassword(email: email, password: password))
userOnboardedAndLoggedIn = true
} catch {
print("Error is \(error)")
print("Failed to log in user: \(error.localizedDescription)")
if error.localizedDescription == "confirmation required" {
errorMessage = "Looks like you haven't confirmed yet. Check your spam folder and make sure your email address is correct"
} else if error.localizedDescription == "invalid username/password" {
errorMessage = "Your username or password is invalid"
} else {
errorMessage = error.localizedDescription
}
}
}
}
}