Hi have tried to use the phone authentication from firebase, but it is failing. I have read a lot of question regarding this problem and most of them mentioned to create the apn key in developer.apple.com
Maybe that could work, but the thing is that I have used the phone authentication in another apps that have access to the same firebase project and I didn't add any apn key.
For "Delivery Clientes" I can authenticate using phone number, but for "DeliveryAppRestaurant" not. This is my third app using authentication with phone number, but I don't know what I'm missing (I know that i have never create an apn key, so I think that's not necessary). I think that I'm forgetting something. I already add the URL at info Runner
And I'm still receiving the exception of: [firebase_auth/invalid-app-credential] Invalid token.
And this is only happening when I tested in real device, in the simulators works fine. Any thoughts?
regards,
If somebody face the same problem than me. It seems that if your app have notifications services:
You should add apn key on firebase:
Also if you have problem with connection recaptcha, you can add the following lines on AppDelegate
//Auth
override func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let firebaseAuth = Auth.auth()
firebaseAuth.setAPNSToken(deviceToken, type: AuthAPNSTokenType.unknown)
}
override func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
let firebaseAuth = Auth.auth()
if (firebaseAuth.canHandleNotification(userInfo)){
print(userInfo)
return
}
}