vinay yedla
vinay yedla

Reputation: 141

Showing error popup "Something went wrong please try again" on Firebase phone authentication

I am using Firebase Phonenumber authentication for signing my iOS app. I updated Firebase Pod from 'Firebase/Auth', '~> 4.5.0' to 'Firebase/Auth' and tried to verify phone number it always showing "Something went wrong. Please try again" error popup.

Does anyone face the same issue? Please let us know if you have any solution for the same

As someone mentioned in Github, tried removing didRegisterForRemoteNotificationsWithDeviceToken and didReceiveRemoteNotification methods as FUIAuthDelegate implements these functions automatically. This solution also didn't work.

func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
        //Handle Firebase Authentication
        // Pass device token to auth
        Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenType.prod)
    }

func application(_ application: UIApplication,
                 didReceiveRemoteNotification notification: [AnyHashable : Any],
                 fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    //Handle Firebase Authentication
    if Auth.auth().canHandleNotification(notification) {
        completionHandler(UIBackgroundFetchResult.noData)
        return
    }
}

After verify click it should navigate to OTP page.

Upvotes: 0

Views: 2281

Answers (2)

While the app was compiled or in runtime (Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenType.prod)) -> we need to change the device token type. set (Auth.auth().setAPNSToken(deviceToken, type: AuthAPNSTokenType.sandbox)) while run the app and check the Firebase phone authentication.

Upvotes: 0

Munzareen Atique
Munzareen Atique

Reputation: 480

You need to follow firebase documentation for the phone authentication. I m attaching a link :

https://firebase.google.com/docs/auth/ios/phone-auth

And also you need to create push notification certificate in apple developer account and configure it with firebase. If this won't help so kindly write me back i would love to help you step by step.

Upvotes: 3

Related Questions