Open jaysonragasa opened 3 years ago
Good thing is, it works in version 1.5.3.2 for Android 11
Thanks @jamesmontemagno that fixes the issue
https://github.com/xamarin/Essentials/issues/1586#issuecomment-747065477
Hi @jamesmontemagno sorry I have to reopen the issue.
Tester came back to me and reported it still crashing. I checked appcenter.ms and still pointing the same issue. Do you have any idea what's going on?
It worked on Android 11 emulator, but when tested on an actual device, it crashes.
Hmmmm @mattleibow is it possible that all of the stuff could be null for extras? https://github.com/xamarin/Essentials/blob/main/Xamarin.Essentials/WebAuthenticator/WebAuthenticatorIntermediateActivity.android.cs#L24
Is there some other flag we need to add on the Activity?
version 1.5.3.2 works for Android 11 in both Emulator and in actual device
Same here, after applied the extra setting in AndroidManifest.xml (#1586). The same exception still reported.
@jamesmontemagno @mattleibow I have created an example project. It can be reproduced on Android 10 as well as Android 11. https://github.com/Px7-941/IssueWebAuthenticator1626
The test opens a fake page with a redirection to the schema "essentialsauth: //". The first part of the oauth authorization code flow is simulated. The problem only occurs if all browsers with Custom Tabs support have been uninstalled or deactivated.
I tested it with Opera, Firefox and Microsoft Edge. https://play.google.com/store/apps/details?id=org.mozilla.firefox https://play.google.com/store/apps/details?id=com.opera.browser https://play.google.com/store/apps/details?id=com.microsoft.emmx
It works with Google Chrome because of custom tabs support. https://play.google.com/store/apps/details?id=com.android.chrome Brave works only on Android 10. https://play.google.com/store/apps/details?id=com.brave.browser
I have the same problem on my device Nokia 7.1 on Android 10.0 - API 29.
Update: It works only on the first try, the second one fails!
We have the same issue after updating to the new TargetFramework version 11
System.NullReferenceException: Object reference not set to an instance of an object.
at Xamarin.Essentials.WebAuthenticatorIntermediateActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00018] in D:\a\1\s\Xamarin.Essentials\WebAuthenticator\WebAuthenticatorIntermediateActivity.android.cs:24
at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <b24a608f3e284c3e8fda498590205f05>:0
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.32(intptr,intptr,intptr)
fromUnobservedEvent: AndroidEnvironment_UnhandledExceptionRaiser
02-11 00:29:03.005 I/mono-stdout(11761): System.NullReferenceException: Object reference not set to an instance of an object.
02-11 00:29:03.005 I/mono-stdout(11761): at Xamarin.Essentials.WebAuthenticatorIntermediateActivity.OnCreate (Android.OS.Bundle savedInstanceState) [0x00018] in D:\a\1\s\Xamarin.Essentials\WebAuthenticator\WebAuthenticatorIntermediateActivity.android.cs:24
02-11 00:29:03.006 I/mono-stdout(11761): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_savedInstanceState) [0x0000f] in <b24a608f3e284c3e8fda498590205f05>:0
02-11 00:29:03.006 I/mono-stdout(11761): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.32(intptr,intptr,intptr)
02-11 00:29:03.006 I/mono-stdout(11761): fromUnobservedEvent: AndroidEnvironment_UnhandledExceptionRaiser
02-11 00:29:03.024 D/Mono (11761): DllImport searching in: '__Internal' ('(null)').
I found the fix. Well: If your project's Target Android version is set to Android 11 (R API 30) you must update your Android Manifest with queries that are used with the new package visibility requirements. https://developer.android.com/preview/privacy/package-visibility
Please add that to your AndroidManifest.xml file
<queries>
<intent>
<action android:name="android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
@AndreyBespamyatnov Does it also work if you uninstall or disable all browsers that support custom tabs? I have a crash when I use a normal browser (Google Chrome disabled) and then come back to the app.
I hope this PR #1687 solves the problem.
@Px7-941 It sounds like another issue, and it is not related to current one #1626 But, I tested your scenario, I have almost the same behavior, I do not have a crash (I'm catching all exception) but the authentication just does not work.
@Px7-941 It sounds like another issue, and it is not related to current one #1626 But, I tested your scenario, I have almost the same behavior, I do not have a crash (I'm catching all exception) but the authentication just does not work.
What do you mean @AndreyBespamyatnov. you don't have any crash and still it's not working then what's the isssue you are facing? Can you please elaborate?
@Px7-941 It sounds like another issue, and it is not related to current one #1626 But, I tested your scenario, I have almost the same behavior, I do not have a crash (I'm catching all exception) but the authentication just does not work.
What do you mean @AndreyBespamyatnov. you don't have any crash and still it's not working then what's the isssue you are facing? Can you please elaborate?
Hi, sorry, but I think I fixed my issue, and now it works. Just add needed intent action
thanks @jamesmontemagno you save my time bug fix #1586 but there is an issue with WebAuth on iOS 12(iPhone 6) there is not any support to return to application. I confirmed my callback uri scheme because everything is working on other all devices on android and iOS but not on iOS 12. Is there any solution please guide me.
I have a project that is running perfectly in Android 8 to 10 and it uses WebAuthenticator for oAuth authentication.
The app is targeting Android 11, running it in an actual Android 10 device is ok, but when ran into Android 11 in both emulator and in actual device. It throws an error
Expected Behavior
Should be able to authenticate in oAuth
Actual Behavior
Crashes the app
Basic Information
Reproduction Link
I cannot provide a reproducable link but here's the code. The highlighted part is where the error occurs