I’m using MongoDB’s Atlas Device Sync (until recently it was called Realm Sync) to handle login for my iOS app, coded in Swift.
I am UK based, and the app works fine for users in the UK. However, I recently sent the app to contacts in Eastern Europe (Poland, Belarus, potentially other countries as well. One person also tried logging in using a French VPN apparently) and they’ve all received the same error when creating an account or logging in with an already created account.
The localised description of this error is “cannot parse response”.
Unfortunately I am based in the UK so I can’t replicate it on my own device. However, I know that the error when creating an account is being thrown from the below code:
app.emailPasswordAuth.registerUser(email: email!, password: password!, completion: { [weak self] (error) in
DispatchQueue.main.async {
guard error == nil else {
self!.signUpFailed(with: error!)
return
}
self!.signIn(with: self!.email!, and: self!.password!)
}
})
And I know that the error when logging in to an already created account is being thrown from the below code:
app.login(credentials: Credentials.emailPassword(email: email, password: password)) { [weak self] (result) in
DispatchQueue.main.async {
switch result {
case .failure(let error):
self!.signInFailed(with: error)
return
case .success(let user):
self!.continueLoggingIn()
}
}
}
I’m at a bit of a loss here. I have no idea why the response can be parsed in the UK but not other countries. I assume it’s an issue with Mongo/Realm but I could be wrong. If anyone can shed any light it would be greatly appreciated.