FirebaseAuthInvalidCredentialsException ERROR_CUSTOM_TOKEN_MISMATCH - android

I have problems with Firebase Phone Auth.
Previously I used debug version and firebase account of user A. Then, we made publication on play market and it stopped sending sms.
I remove this project to another firebase acc that belongs to play services account owner. Created app, correctly fill in app id, connected it with play market app and then got json file from firebase and placed it in project.
When call to sendSms, nothing happpens (I did not change realization, only moved project from one acc to another)
Logs says
07-22 15:30:35.965 32553-32553/ru.falcode.lcd_android
W/DynamiteModule: Local module descriptor class for
com.google.firebase.auth not found.
07-22 15:30:35.966
32553-32553/ru.falcode.lcd_android W/BiChannelGoogleApi:
[FirebaseAuth: ] getGoogleApiForMethod() returned Gms:
com.google.firebase.auth.api.internal.zzal#3e65d46 07-22 15:30:35.977
32553-32761/ru.falcode.lcd_android W/DynamiteModule: Local module
descriptor class for com.google.firebase.auth not found. 07-22
15:30:35.984 32553-32761/ru.falcode.lcd_android I/FirebaseAuth:
[FirebaseAuth:] Loading module via FirebaseOptions.
[FirebaseAuth:] Preparing to create service connection to gms implementation 07-22 15:30:36.240 32553-32615/ru.falcode.lcd_android
V/FA: Inactivity, disconnecting from the service 07-22 15:30:36.608
32553-32553/ru.falcode.lcd_android W/TAG: onVerificationFailed
com.google.firebase.auth.FirebaseAuthInvalidCredentialsException: The custom token corresponds to a different audience. [ App ID does
not match requested project. ]
at com.google.firebase.auth.api.internal.zzce.zzb(Unknown Source)
at com.google.firebase.auth.api.internal.zzdf.zza(Unknown Source)
at com.google.firebase.auth.api.internal.zzdg.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6195)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779) 07-22
15:30:36.608 32553-32553/ru.falcode.lcd_android
E/FirebaseAuthInvalidCredentialsException: The custom token
corresponds to a different audience. [ App ID does not match requested
project. ]
ERROR_CUSTOM_TOKEN_MISMATCH
We never used custom keys. Just an example from git hub with no customization over it.
How to fix it?

I agree the error code is confusing. But the error message is key here: "App ID does not match requested project. " The same app used to obtain the phone auth credential should be the one used to sign in with it. That is why you are getting the error. It seems like you are getting the phone auth credential with one application and then signing in with that credential using another app.

I think you are testing your project with a normal .apk in your mobile or in the emulator. If you want to test your project for mobile authentication you have to provide your mobile number in the firebase mobile authentication in sing-in-method. Testing the mobile number(Optional mobile number) by which you want to test. Or you make a signed .apk and then try it again I think it will work fine.

Related

AbstractCommandTask: Exception occurred while processing task: com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null

I was using for Amazon In-App Purchases (IAP) in-app-purchasing-2.0.76.jar and switched to com.amazon.device:amazon-appstore-sdk:3.0.2 after their latest update. I followed the instructions provided by Amazon for the migration to AppstoreSDK.
I also followed the updated instructions for AppTester as described here.
But, I receive an Authentication Exception:
D/Kiwi: AbstractCommandTask: Exception occurred while processing task: com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null
com.amazon.a.a.n.a.a.a: AUTH_TOKEN_VERIFICATION_FAILURE: null: null
at com.amazon.a.a.n.a.b.a(AuthenticationTokenVerifier.java:94)
at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:204)
at com.amazon.a.a.n.a.a.a(AbstractCommandTask.java:131)
at com.amazon.a.a.n.b.b$1.run(SimpleTaskPipeline.java:179)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:65)
Thus, the listener for methods: PurchasingService.getUserData(); and PurchasingService.getPurchaseUpdates(true); is not triggered.
Tried and failed:
Update ProGuard for possible obfuscation in Amazon classes.
Remove V2 signing for debug .apk.
Ensure that I am in Sandbox Mode.
Update AppstoreAuthenticationKey.pem file from Amazon Developer Console.
Update amazon.sdktester.json file from Amazon Developer Console.
Compare existing code with the documentation provided by Amazon.
Note: The exact same implementation with in-app-purchasing-2.0.76.jar was working.
All the above were tested in Amazon Kindle Fire HD 10 tablet running Fire OS 7.3.2.2
Any thoughts?
As you mention the Amazon App Tester app, I presume you receive the AUTH error during local testing.
If so, check your final merged AndroidManifest.xml contains the receiver tags needed for the Amazon App Tester to respond to your sandbox API requests:
https://developer.amazon.com/docs/in-app-purchasing/iap-implement-iap.html#responsereceiver
I had the same issue using build flavours (one for Google, one for Amazon) and the receiver tags were being ignored in the Amazon manifest.

Unable to decode stream: android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'

I've recently tried implementing Pusher's Chatkit into my android app along with some Kotlin plugins and am now running into this error that I cannot resolve.
E/Drawable: Unable to decode stream: android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error.
the error I'm getting right below it is:
E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
Which is through throwing me for a loop because my internet is working fine although a couple lines further down, I get:
W/Firestore: (21.3.0) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
Process 15216 terminated.
Note: I've started to get this error above about not having a good connection ever since I started working more at cafes instead of at home since I needed to get out. In order to work offline, firebase asked me to opt into an offline mode I've been getting this notification of not being able to connect ever since.
I am following along to the getting started page here and have completed up to the end of the "Displaying Messages" section however when I go to the activity, it just stalls and blanks out. I have been searching StackO and the rest of the web for the past 2 days to try to resolve the conflict to no avail. All of the similar posts I have looked at dont seem to resolve the issue.
similarPost#1 but I'm not trying to save to a bitmap
Here is the entire stack trace:
E/Drawable: Unable to decode stream: android.graphics.ImageDecoder$DecodeException: Failed to create image decoder with message 'unimplemented'Input contained an error.
E/FirebaseInstanceId: Token retrieval failed: SERVICE_NOT_AVAILABLE
W/DynamiteModule: Local module descriptor class for providerinstaller not found.
I/DynamiteModule: Considering local module providerinstaller:0 and remote module providerinstaller:0
W/ProviderInstaller: Failed to load providerinstaller module: No acceptable module found. Local version is 0 and remote version is 0.
I/ghborsbookshel: The ClassLoaderContext is a special shared library.
I/chatty: uid=10086(com.example.android_myneighborsbookshelf) AsyncTask #2 identical 1 line
I/ghborsbookshel: The ClassLoaderContext is a special shared library.
V/NativeCrypto: Registering com/google/android/gms/org/conscrypt/NativeCrypto's 286 native methods...
W/ghborsbookshel: Accessing hidden method Ljava/security/spec/ECParameterSpec;->getCurveName()Ljava/lang/String; (light greylist, reflection)
I/ProviderInstaller: Installed default security provider GmsCore_OpenSSL
W/Firestore: (21.3.0) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
Process 15216 terminated.
It seems to have fixed itself except for the unable to decode stream error however it doesn't crash, it just shows up in the log.
I checked for updates, cleaned, rebuild, invalidated caches and restarted, and shut down my emulator. I also restarted my computer completely 2x and that seems to have fixed it.

Firebase In App Messaging PERMISSION_DENIED

I did setup for firebase in App messaging. Created campaign and my app can't deliver it.
In logcat I got following logs
2019-02-26 11:22:40.616 16131-16131/app.package.name I/FIAM.Headless: Starting InAppMessaging runtime with Instance ID ciy4xtnJqBQ
2019-02-26 11:22:42.153 16131-16131/app.package.name I/FIAM.Headless: Setting display event listener
2019-02-26 11:22:42.457 16131-16131/app.package.name I/FIAM.Headless: went foreground
2019-02-26 11:22:42.464 16131-16157/app.package.name I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: false | App Fresh Install: true
2019-02-26 11:22:42.472 16131-16157/app.package.name W/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/app.package.name/files/fiam_impressions_store_file: open failed: ENOENT (No such file or directory)
2019-02-26 11:22:42.483 16131-16157/app.package.name I/FIAM.Headless: Fetching campaigns from service.
2019-02-26 11:22:42.999 16131-16157/app.package.name W/FIAM.Headless: Service fetch error: PERMISSION_DENIED: Requests to this API firebaseinappmessaging.googleapis.com method google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServing.FetchEligibleCampaigns are blocked.
Setup
Android studio 3.3.1
com.google.firebase:firebase-inappmessaging-display:17.0.5
com.google.firebase:firebase-core:16.0.7
Firebase in app messaging API enabled in Google Cloud Console
What could be reason of?
2019-02-26 11:22:42.999 16131-16157/app.package.name W/FIAM.Headless: Service fetch error: PERMISSION_DENIED: Requests to this API firebaseinappmessaging.googleapis.com method google.internal.firebase.inappmessaging.v1.sdkserving.InAppMessagingSdkServing.FetchEligibleCampaigns are blocked.
The reason of the issue was restriction on API key for Android app. So InAppMessaging API was enabled for the whole project but it also require add InAppMessaging API to the specific platform API key restriction.
you have to add the firebase InApp Messaging permission to your Google Cloud API, can be done from the Google Cloud Console

This app is not authorized to use Firebase Authentication

I am getting this error when using Firebase mobile authentication on my physical device.
Looking for solutions I did the following:
1.Updated SHA1 in firebase console
2.I am using firebase Api and android N
3.I checked for play store updates and it shows that it is the latest version
Note: I am not using a emulator but a real device and it still is not working.
02-25 11:25:23.430 13164-13164/com.odetion.odetion W/BiChannelGoogleApi: [FirebaseAuth: ] getGoogleApiForMethod() returned Gms
02-25 11:25:24.077 13164-13164/com.odetion.odetion W/OtpVerificationActivity: onVerificationFailed
com.google.firebase.auth.FirebaseAuthException: This app is not authorized to use Firebase Authentication. Please verifythat the correct package name and SHA-1 are configured in the Firebase Console. [ App validation failed ]
at com.google.android.gms.internal.zzdxm.zzao(Unknown Source)
at com.google.android.gms.internal.zzdye.zza(Unknown Source)
at com.google.android.gms.internal.zzdyf.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6165)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
As you error says:
Please verifythat the correct package name and SHA-1 are configured in the Firebase Console.
So the problem is either your package name isn't correct or either your SHA-1. Make sure both are correct and try again.

DatabaseError: The operation had to be aborted due to a network disconnect firebase

I am using firebase in my android application to store the image urls liked by the user. But when the user likes the first image when the application is opened the image url is not stored in the firebase and logs:
The operation had to be aborted due to a network disconnect firebase
When the user further likes the images it is properly stored in the firebase with no issues.
What could be the possible reason for this error?
Logs are:
08-26 11:35:16.703 23419-23419/prithvi.wallpaper:background_crash I/FirebaseCrashSenderServiceImpl: FirebaseCrashSenderServiceImpl created by ClassLoader com.google.android.chimera.container.internal.DelegateLastPathClassLoader[DexPathList[[zip file "/data/data/com.google.android.gms/app_chimera/m/00000008/DynamiteModulesC_GmsCore_prodmnc_xxhdpi_release.apk"],nativeLibraryDirectories=[/data/user/0/com.google.android.gms/app_chimera/m/00000008/n/armeabi-v7a, /data/user/0/com.google.android.gms/app_chimera/m/00000008/n/armeabi, /vendor/lib, /system/lib]]]<br/>
08-26 11:35:16.704 23419-23419/prithvi.wallpaper:background_crash D/FirebaseCrashSenderServiceImpl: onCreate<br/>
08-26 11:35:17.449 23168-23168/prithvi.wallpaper I/DynamiteModule: Considering local module com.google.android.gms.firebase_database:3 and remote module com.google.android.gms.firebase_database:3<br/>
08-26 11:35:17.449 23168-23168/prithvi.wallpaper I/DynamiteModule: Selected remote version of com.google.android.gms.firebase_database, version >= 3<br/>
08-26 11:35:19.036 23168-23483/prithvi.wallpaper W/RepoOperation: Transaction at /odKqVUDKv1TlRNmBFN9tXfeM3T93/liked_photos/-KQ4RxQkK7DHGYS8baD4 failed: DatabaseError: The operation had to be aborted due to a network disconnect<br/>
08-26 11:35:19.259 23168-23212/prithvi.wallpaper W/DynamiteModule: Local module descriptor class for com.google.firebase.auth not found.
This is a known Firebase bug that is discussed here. The Firebase engineer in the discussion said:
It's related to doing a transaction before we get connected. As a
workaround, you could listen to the ".info/connected" location in
Firebase, wait for it to become true (i.e. you are authenticated) and
then do the transaction.
The problem appears to still exist in version 9.4.0.

Categories

Resources