TobiasBuchholz / Plugin.Firebase

Wrapper around the native Android and iOS Firebase Xamarin SDKs
MIT License
219 stars 49 forks source link

AUTHENTICATION_FAILED Android API 31 #161

Closed JoacimWall closed 1 year ago

JoacimWall commented 1 year ago

Hi and thanks for great nuget.

I run a Maui App that all works on Android Api 33 but on API 31 I get this java.util.concurrent.ExecutionException: java.io.IOException: AUTHENTICATION_FAILED when I access FirebaseCloudMessagingImplementation.GetTokenAsync()

//Joacim

Exception: at Plugin.Firebase.CloudMessaging.FirebaseCloudMessagingImplementation.GetTokenAsync() at LiberoClub.App.OnSleep() in /Users/joacimwall/GitRepos/nbcMAui/LiberoClub/App.xaml.cs:line 231 --- End of managed Java.IO.IOException stack trace --- java.io.IOException: java.util.concurrent.ExecutionException: java.io.IOException: AUTHENTICATION_FAILED at com.google.firebase.messaging.FirebaseMessaging.blockingGetToken(FirebaseMessaging.java:625) at com.google.firebase.messaging.FirebaseMessaging.lambda$getToken$4$com-google-firebase-messaging-FirebaseMessaging(FirebaseMessaging.java:392) at com.google.firebase.messaging.FirebaseMessaging$$ExternalSyntheticLambda9.run(Unknown Source:4) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at com.google.android.gms.common.util.concurrent.zza.run(com.google.android.gms:play-services-basement@@18.1.0:2) at java.lang.Thread.run(Thread.java:920) Caused by: java.util.concurrent.ExecutionException: java.io.IOException: AUTHENTICATION_FAILED at com.google.android.gms.tasks.Tasks.zza(com.google.android.gms:play-services-tasks@@18.0.2:5) at com.google.android.gms.tasks.Tasks.await(com.google.android.gms:play-services-tasks@@18.0.2:8) at com.google.firebase.messaging.FirebaseMessaging.blockingGetToken(FirebaseMessaging.java:623) ... 9 more Caused by: java.io.IOException: AUTHENTICATION_FAILED at com.google.firebase.messaging.GmsRpc.handleResponse(GmsRpc.java:309) at com.google.firebase.messaging.GmsRpc.lambda$extractResponseWhenComplete$0$com-google-firebase-messaging-GmsRpc(GmsRpc.java:320) at com.google.firebase.messaging.GmsRpc$$ExternalSyntheticLambda0.then(Unknown Source:2) at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:3) at androidx.window.layout.WindowInfoTrackerImpl$windowLayoutInfo$1$$ExternalSyntheticLambda1.execute(Unknown Source:0) at com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.2:1) at com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.2:5) at com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.2:3) at com.google.android.gms.tasks.zzc.run(com.google.android.gms:play-services-tasks@@18.0.2:8) at com.google.android.gms.cloudmessaging.zzz.execute(Unknown Source:0) at com.google.android.gms.tasks.zzd.zzd(com.google.android.gms:play-services-tasks@@18.0.2:1) at com.google.android.gms.tasks.zzr.zzb(com.google.android.gms:play-services-tasks@@18.0.2:5) at com.google.android.gms.tasks.zzw.zzb(com.google.android.gms:play-services-tasks@@18.0.2:3) at com.google.android.gms.tasks.TaskCompletionSource.setResult(com.google.android.gms:play-services-tasks@@18.0.2:1) at com.google.android.gms.cloudmessaging.zzp.zzd(com.google.android.gms:play-services-cloud-messaging@@17.0.0:3) at com.google.android.gms.cloudmessaging.zzr.zza(com.google.android.gms:play-services-cloud-messaging@@17.0.0:2) at com.google.android.gms.cloudmessaging.zzf.handleMessage(com.google.android.gms:play-services-cloud-messaging@@17.0.0:14) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7839) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)

TobiasBuchholz commented 1 year ago

Is this issue maybe related to https://github.com/TobiasBuchholz/Plugin.Firebase/issues/162 or could you provide a sample project?

JoacimWall commented 1 year ago

Hi Below you have I sample project. https://github.com/JoacimWall/Joacim_Bug_Report/tree/main/Firebase

This works on API33 but not on API31 Android

//Joacim

TobiasBuchholz commented 1 year ago

Hey @JoacimWall, I'm sorry but I wasn't able to reproduce your issue. For me it worked on Pixel 5, 6 and 7 with the target api levels 30, 31 and 33, see screenshots. Maybe this issue is somehow related to your device?

Google Pixel 5 - API 30 screenshot-Google Pixel 5-11 0

Google Pixel 6 - API 31 screenshot-Google Pixel 6-12 0

Google Pixel 7 - API 33 screenshot-Google Pixel 7-13 0

JoacimWall commented 1 year ago

Hi Google Play Store generate the error.
if I add a new pixel 5 device(simulator) API 31 then I get a token. if I run on a pixel 2 device with google Play Store checked (simulator) API 31 I get error on below row.

if I copy the device and remove Google Play Store then I get the token.

image image image image image

//Joacim