Is it possible to intercept an http://example.com/callback redirect in a intentFilter?

0

I'm trying to use an Intent-Filter to capture when a browser redirected to a page confirming the authorization process (final url for test is "http://shapp.sytes.net:8080/callback/loginsuccessful?client_id=...".

But I'm able to open the native browser from within app, it goes to auth page, gets redirected to link above, but my intent-filter does not intercept the redirect.

Is it possible to do it and I'm missing something?

Tried some variations of the code bellow. And also tried to start the activity via adb. Gettin this error: Error: Activity not started, unable to resolve Intent { act=android.intent.action.VIEW dat=http://shapp.sytes.net:2080/... flg=0x10000000 pkg=com.companyname.oauthnativeflow }

[Activity(Label = "CustomUrlSchemeInterceptorActivity", NoHistory = true, 
LaunchMode = LaunchMode.SingleTop)]
[IntentFilter(
    new[] { Intent.ActionView },
    Categories = new[] { Intent.CategoryDefault, Intent.CategoryBrowsable },
    DataSchemes = new[] { "http"},
    DataHosts = new [] { "shapp.sytes.net:2080"},
    //DataPath = "/Callback",
    DataPathPrefix ="/callback")]
public class CustomUrlSchemeInterceptorActivity : Activity
{
    protected override void OnCreate(Bundle savedInstanceState)
    {
        base.OnCreate(savedInstanceState);

        // Convert Android.Net.Url to Uri
        var uri = new Uri(Intent.Data.ToString());

        // Load redirectUrl page
        AuthenticationState.Authenticator.OnPageLoading(uri);

        Finish();
    }
}

A break-point in the OnCreate method is never activated.

Any thoughts?

c#
android
xamarin
intentfilter
asked on Stack Overflow Jan 17, 2019 by Andre Alwy de Souza • edited Jan 17, 2019 by Llama

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0