mjb
mjb

Reputation: 41

Servicestack, Xamarin and authentication

I've got an ServiceStack service running with custom authentication, this runs fine from the browser and through a Windows console program. I'm now trying to get a simple Xamarin Android program to authenticate but whatever I try it crashes with an Exception without any further explanation. The code I am using stops at the line with 'var authResponse', I'm using the 4.0.44 ServiceStack packages and the lastest stable Xamarin from inside VS2015.

        protected override void OnCreate (Bundle bundle)
    {
        base.OnCreate (bundle);

        // Set our view from the "main" layout resource
        SetContentView (Resource.Layout.Main);
        // servicestack
        var client = new JsonServiceClient("http://10.0.2.2:8080");
        var authResponse = client.Get<AuthenticateResponse>( new Authenticate
        {
            UserName = "Willem",
            Password = "secret",
            RememberMe = true
        });

Any pointers to what/where I should look? tia

Upvotes: 3

Views: 115

Answers (1)

mythz
mythz

Reputation: 143284

If this is a self-hosted Service you would need to register the HttpListener AppHost to accept requests from different hosts by listening on a host wildcard, e.g:

appHost.Start("http://*:8080/"); 

Upvotes: 2

Related Questions