xamarin / Xamarin.Auth

Xamarin.Auth
Apache License 2.0
542 stars 350 forks source link

App crash in Android 12 devices because of Xamarin.Auth #459

Open suman-chava-by opened 2 years ago

suman-chava-by commented 2 years ago

Xamarin.Auth Issue

Issue: In Android 12 (the recently released Android version), the mobile application crashes when the user tries to login via SSO. After debugging for the root cause, it is found that, Xamarin.Auth nuget is throwing an error as shown below :

"Java.Lang.IllegalArgumentException: {packageName}: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles."

Please find below the code at which the error is thrown :

var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter(); presenter.Login(authenticator);

Is there any Fix targeted or Currently being worked on by the MS Xamarin team to fix this?

Impact : More than 10K users will be impacted once they have upgraded their Android Devices OS to Android 12, since they can't login to their app because of this issue.

Version

Platform:

Expected behaviour

App should redirect the login flow to an SSO Webpage and display the login screeen.

Actual behaviour

App is crashing instead of redirecting to SSO web page

Screenshot :

MicrosoftTeams-image (8)
akhil-shukla-by commented 2 years ago

@xamarin-release-manager Kindly help us as this is a blocker for Android 12

akhil-shukla-by commented 2 years ago

The fix details:

Project: Xamarin.Auth.XamarinAndroid File : CustomTabsConfiguration.cs Line number : 470

Fix:

PendingIntent broadcast = PendingIntent.GetBroadcast ( activity.ApplicationContext, actionSourceId, actionIntent, //0 : this needs to be removed and immutable flag needs to be added. PendingIntentFlags.Immutable );

akhil-shukla-by commented 2 years ago

image

yasmanillanes commented 2 years ago

Is this project not being maintained anymore? Is this fix ever going to be released?

kyluke commented 2 years ago

When is this being fixed?

frixos25 commented 1 year ago

I am waiting for this fix....

nc-kano commented 1 year ago

it is not worth it to ask for fix. it will be never fixed as the last change in the repo was 3 years ago. In our project we had to fork the repo and build a custom version of it on our own. But the best solution is just to drop it and use something good instead.

sviluppomania commented 1 year ago

@moljac

christian-strydom commented 1 year ago

This is so frustrating. On StackOverflow it is suggested to install the Xamarin.AndroidX.Work.Runtime package to get around the issue, but it seems there are Kotlin version mismatches between the packages then. Has anyone been able to find a workaround for this?

sviluppomania commented 1 year ago

Questo è così frustrante. Su StackOverflow si consiglia di installare il pacchetto Xamarin.AndroidX.Work.Runtime per aggirare il problema, ma sembra che ci siano mancate corrispondenze di versione di Kotlin tra i pacchetti. Qualcuno è stato in grado di trovare una soluzione per questo?

@MattiaVicari

christian-strydom commented 1 year ago

This is so frustrating. On StackOverflow it is suggested to install the Xamarin.AndroidX.Work.Runtime package to get around the issue, but it seems there are Kotlin version mismatches between the packages then. Has anyone been able to find a workaround for this?

Turns out I had to update some of my other nuget packages. But unfortunately Xamarin.AndroidX.Work.Runtime package did not solve the issue. I ended up using Plugin.GoogleClient package with Firebase setup to get Google sign in on Android and iOS working.

MattiaVicari commented 1 year ago

If we want to continue using this package in our Xamarin project, I think the only thing we can do is fork the repository and fix the issue ourselves. I did too (here my fork), as someone else said. It is very sad that no one is maintaining this repository....

I have built the DLLs, uninstalled the Xamarin.Auth package from my project and added them as reference:

TheSundayDev commented 1 year ago

ciao all, so no official way to fix? thanks Mattia. is there any other way to login using google in xamarin form? thanks

andygikling commented 1 year ago

Run away from this repo, and Xamarin, as fast as you can. What a joke.

jhonata0302 commented 1 year ago

a possible solution is to use the Xamarin.Essentials library with Xamarin.Essentials.WebAuthentic https://learn.microsoft.com/xamarin/essentials/web-authenticator?context=xamarin%2Fandroid&tabs=android

Gvtha23 commented 11 months ago

Is any solution for resolving this issue of Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent while calling the below code

var presenter = new Xamarin.Auth.Presenters.OAuthLoginPresenter(); presenter.Login(authenticator);