Firebase OTP only works in some devices - Swift 4 - firebase

I am using firebase authentication in my device. I have followed every steps in firebase documentation. The OTP works in the devices that I used for testing purpose. But when I download the app from AppStore, It does not work. Please help me to get rid of this issue. Thanks in advance.

I got the answer.
There were 2 things wrong with what I was done.
When I created SSL certificate (For push notification) from App Ids under 'Certificates, Identifiers & Profiles' tab in developer.apple.com, The certificate was not created for production. So I created one for production.
I forgot to create APNs key. So I created APNs key from Keys under 'Certificates, Identifiers & Profiles' tab in developer.apple.com. Then I uploaded it in the firebase App (console.firebase.google.com). After you select your project, you can find a gear icon in the firebase website. Select project settings from there and click on the cloud messaging tab. And there you can find the option to upload APNs certificate.

Related

Firebase database not working after uploading application to play store

I have updated SHA-1 key to firebase project settings from Google Play console. Also I have added release and debug SHA-1 keys. But still google team can't able to use the app. It is login successfully with testing mobile number and OTP, but after that it will fetch data from firebase database in an activity. At that moment application got crashed. And it is rejected by them again and again.
Kindly help me on this.

How to disable reCaptcha in firebase phone-auth (OTP) android?

I've updated the firebase library recently and didn't change anything else.
implementation 'com.google.firebase:firebase-auth:20.0.1'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.firebase:firebase-storage:19.2.0'
implementation 'com.google.android.gms:play-services-auth:19.0.0'
but whenever a user tries to signup, a Recaptcha is showing for a few seconds and then sometimes redirects to a web browser (CustomChromeTab) after that OTP is received from firebase auth. It takes about 15-30 seconds. How to prevent the Recaptcha? However, I added the SHA1 and SHA256 in the firebase console and have not changed the code. Thanks.
Here is the screenshot of the captcha verification process:
Most of the times while implementing dependencies like:
implementation 'androidx.browser:browser:1.2.0'
the above window pops-up in the browser.
Here, is a way to resolve it successfully.
Step 1-
In the Google Cloud Console, enable the Android DeviceCheck API for your project. The default Firebase API Key will be used, and needs to be allowed to access the DeviceCheck API.
Step 2-
If you haven't yet specified your app's SHA-256 fingerprint, do so from the Settings Page of the Firebase console. Refer to Authenticating Your Client for details on how to get your app's SHA-256 fingerprint.
Hope it works!!!
For more information, you can also check Google SafetyNet API for checking Google Play Services installation in device at the time of Phone Authentication.
Also, need to perform additional steps:
Firebase Project Settings > App check > and Register firebase project in SafetyNet and Play Integrity register with default time token 1 hour.
Don't forget to go in Firebase Project Settings > App check > and Register firebase project in SafetyNet and Play Integrity register with default time token 1 hour and u will remove reCaptcha from phone auth OTP!
Try this alternative method to disable reCaptcha
mAuth = FirebaseAuth.getInstance();
// set this to remove reCaptcha web
mAuth.getFirebaseAuthSettings().setAppVerificationDisabledForTesting(true);
because I've been following Mohd Asim answer, and it doesn't work.
In order to remove the captcha verification, you have to do this in Google cloud console.
IMPORTANT (you may have done that, but for the reminder):
Add the SHA1 and SHA256 of your project (see how to get) in the firebase project setting page (See how to set).
Go to the Library page in the Google APIs Console.
In the search bar type "Android Device Verification", and select the Android Device Verification box (API). The Android Device Verification API dashboard screen appears.
If the API isn't already enabled, click Enable. Hope here your problem solves and if not then proceed further.
If the Create credentials button appears, click on it to generate an API key. Otherwise, click the All API credentials drop-down list, then select the API key that's associated with your project that has enabled the Android Device Verification API.
In the sidebar on the left, click Credentials. Copy the API key that appears.
Use this API key when you call the attest() method of the SafetyNetClient class.
For more information read this official page - https://developer.android.com/training/safetynet/attestation
go to google cloud console
Select project it should be same project in which firebase is running and make sure you have added sha-1 and sha-256 of both debug and release version and put updated google-services.json file in your app.
search android device verification
click on enable
5.done

Apple rejected the app due to "Token mismatch" authentication error in a Flutter app with Firebase Phone Authentication

Firebase Authentication with phone number is configured and tested on iOS via Testflight but seems that is not working when Apple is reviewing the app.
We provided a whitelisted phone number which worked with the build downloaded from Testflight.
I've found a couple of similar issues in GitHub but all was fixed... I'm using the latest version of Firebase auth plugin.
I added a GitHub issue as well but no reaction there: https://github.com/FirebaseExtended/flutterfire/issues/3800
Did somebody had to deal with this ?
Finally the app passed Apple review. Below is what we did, in case somebody will encounter this in the future:
We had two APN's created in Apple Developer account. The second one was configured in Firebase Console
===> we removed the first so now we have only one APN in Apple Dev account
In Firebase Console we had also certificates uploaded (Firebase states that
those are not used if a .p8 key is uploaded)
===> we removed the unused APN certificate and used only the APN .p8 key.
Resubmitted the app to review and it passed.

Firebase Push Notifcations does not work on Test Flight

I have an IOS Xamarin project that uses firebase for push notifications. The push notifications are working on a debug build. I uploaded the project to Test Flight and push notification are not receiving anymore.
I have a development certificate and a production certificate. I am using an App Store provisioning profile. I have tried revoking and making new certs. I have added FirebaseAppDelegateProxyEnabled - Yes to the info plist. I am receiving firebase tokens in test flight.
Thanks
You must add as well the APNS/Certificate for Production on Firebase, it happens all the time. Check you have both of them.
Better still if you use the P8 Key. In this case you don't need any other certificates whatsoever. For Firebase is the best approach, comment if you need more help.
Cheers.

Creating APN Development Profile Error, "Valid signing identity not found"

I have an iOS App projects that needs push notifications. I followed tutorials on how to create a provisioning profiles for APN such as
http://www.raywenderlich.com/32960/apple-push-notification-services-in-ios-6-tutorial-part-1
https://www.youtube.com/watch?v=nFjEcLCTPM0
but I am always having this error in Provisioning Profile section under Devices
Valid Signing Identity not found
and in Code Signing Identities i have the error
Profile doesn't match any valid certificate/private key pair in your settings
Or is it somehow related to the fact that I already have 2 existing provisioning profiles for an app? I will greatly appreciate tips to fix this problem. Thanks!
Create the provisioning profile using xCode organizer instead of iOS Dev Centre.
Generate CSR using Keychain Access. You can specify any email
address
Create an APP ID at iOS Dev Center. Specify the certSigningRequest file created in step 1
Create the Provisioning Profile using xCode organizer
Generate the PEM files

Resources