1
votes

I've been following the steps to make Windows 8 Store app get an ACS token as described here: Does the WebAuthenticationBroker work in Windows 8 Metro App post Release Candidate

However, the ResponseData property of my WebAuthenticationResult object only contains the callback uri as specified in ACS, and contains no token information. Below my code.

Authentication method of Windows 8 client

private async void Authenticate()
    {
        WebAuthenticationResult webAuthenticationResult = await WebAuthenticationBroker.AuthenticateAsync(
            WebAuthenticationOptions.None,
            new Uri("https://myACSnamespace.accesscontrol.windows.net:443/v2/wsfederation?wa=wsignin1.0&wtrealm=http://localhost:12714/"),
            new Uri("http://mypublicIPaddress:80/WebAppMVCAPI/api/federation/end"));

My Relying Party application Return URL is set to http://mypublicIPaddress:80/WebAppMVCAPI/api/federation/en

My controller on the web application is programmed as follows:

public class FederationController : ApiController
{
    protected virtual string ExtractBootstrapToken()
    {
        return "Hello World";
        //return HttpContext.Current.User.BootstrapToken();
    }

    [HttpGet]
    public string Get()
    {
        return "Hello Get World";
    }

    [HttpPost]
    public HttpResponseMessage Post()
    {
        var response = this.Request.CreateResponse(HttpStatusCode.Redirect);
        response.Headers.Add("Location", "/WebAppMVCAPI/api/federation/end?acsToken=" + ExtractBootstrapToken());
        return response;
    }
}

}

As you can imagine, the web application is running on my IIS Server and listening on port 80. My router is configured to forward incoming requests as needed, and when I launch my web application in visual studio I have access to the application from an internet host.

The idea is to have the Windows 8 store app get a token from ACS with a Facebook login. When I launch the win8 client, the application shows a Facebook login page. I log in with my credentials successfully. However, when I look at the webauthenticationresult.responsedata property, I only see the callback uri. Also, I don't see any log in my firewall that ACS tried to post something to my callback uri.

1
How have you configured your ASP.NET Web API project such that ExtractBootstrapToken() works? I added ACS using the "Identity and Access" wizard for VS2012 and then added the wif.swt nugget package but keep getting errors.markti

1 Answers

1
votes

Your replying party application return URL should be

http://mypublicIPaddress:80/WebAppMVCAPI/api/federation

not

http://mypublicIPaddress:80/WebAppMVCAPI/api/federation/end