Open NickeManarin opened 4 years ago
I'm facing with the same issue in my Xamarin App. I see that this issue is open since the 23rd January 2020. In the meantime, has someone found a workaround for this problem? Thank you
@Redth @jonathanpeppers @NickeManarin
No and I'm no longer working with that. It's possible to close this issue ticket.
Same issue for me
Workaround: use a custom schema different from http and https (for example oauth://) for the callback URL. In this way you can avoid the IntentFilter of the browser and you can intercept that by your App Activity.
Example for the activity:
[Activity(Label = "My Login Authenticator", NoHistory = true, LaunchMode = Android.Content.PM.LaunchMode.SingleTop)] [IntentFilter(new[] { Intent.ActionView }, Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable }, DataScheme = "oauth", DataHosts = new[] { "mydomain.com", "www.mydomain.com" }, DataPathPrefix = "/my_login_callback")]
I didn't find any other solution.
My
IntentFilter
on an Activity is not intercepting the URL when page is redirected/navigated, only when tab is open or when URL scheme changes.Steps to Reproduce
Xamarin.Forms
orXamarin.Android
project.Xamarin.Auth
nuget.Redirect URL
in LinkedIn app settings, it must be the same as the passed parameter inXamarin.Auth
. In my case, I've tried various URLs, even localhost without success. For theIntentFilter
below, I'm usinghttp://localhost:1445/callback
.Activity
with theIntentFilter
:Expected Behavior
After a successful authorization, the page redirects to the
[Redirect URL]
+?code=[AuthCode]
and theIntentFilter
should intercept the call.App flow: User presses "Login with LinkedIn" ▶ App opens a "custom tab" browser (which uses the native UI of the browser, not a
WebView
inside the app) ▶ User logs in on LinkedIn ▶ User authorizes connection between my app and his profile ▶ LinkedIn.com redirects to another Http/Https URL, after checking if the URL is one of the authorized redirect URLs ▶ The browser tab gets closed as theIntentFilter
was able to intercept the navigation (since there's a code that actively closes the browser).Actual Behavior
After a successful authorization, the page redirects to the
[Redirect URL]
+?code=[AuthCode]
but theIntentFilter
does not intercept the call.App flow: User presses "Login with LinkedIn" ▶ App opens a "custom tab" browser (which uses the native UI of the browser, not a
WebView
inside the app) ▶ User logs in on LinkedIn ▶ User authorizes connection between my app and his profile ▶ LinkedIn.com redirects to another Http/Https URL, after checking if the URL is one of the authorized redirect URLs ▶ The browser tab is still being displayed, theIntentFilter
failed to intercept the navigation.Version Information
Microsoft Visual Studio Community 2019 Version 16.4.3 VisualStudio.16.Release/16.4.3+29709.97 Microsoft .NET Framework Version 4.8.03752
Installed Version: Community
Visual C++ 2019 00435-60000-00000-AA924 Microsoft Visual C++ 2019
Xamarin 16.4.000.308 (d16-4@4755fb3) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 16.4.0.475 (remotes/origin/d16-4@ac250f5aa) Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin.Android SDK 10.1.3.7 (d16-4/d66aed0) Xamarin.Android Reference Assemblies and MSBuild support. Mono: fd9f379 Java.Interop: xamarin/java.interop/d16-4@c4e569f ProGuard: xamarin/proguard/master@905836d SQLite: xamarin/sqlite/3.28.0@46204c4 Xamarin.Android Tools: xamarin/xamarin-android-tools/master@9f4ed4b
Xamarin.iOS and Xamarin.Mac SDK 13.10.0.17 (5f802ef) Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.