I have a Windows 8 app that builds a string and posts to https: using WebAuthBroker. Relevant code is below.
The problem is that WebAuthBroker takes this URI and cannot connect, but when I hand=post this URI into IE, it works fine.
Running VS2012 on Windows 8.
In Package.appmanifest, have enabled Enterprise Authentication, Internet(Client), Internet(Client&Server), Private Networks(Client & Server), and Shared User Certificates.
async Task AuthenticateAsync()
{
var requestUriStr = string.Format("{0}?client_id={1}&response_type=token&redirect_uri={2}", logonUriString, clientId, redirectUriString);
requestUriStr += "&scope=stream";
var requestUri = new Uri(requestUriStr, UriKind.RelativeOrAbsolute);
var redirectUri = new Uri(redirectUriString, UriKind.RelativeOrAbsolute);
var result = await WebAuthenticationBroker.AuthenticateAsync(WebAuthenticationOptions.None, requestUri, redirectUri);
if (result.ResponseStatus != WebAuthenticationStatus.Success)
{
throw new Exception("Login failed: " + result.ResponseErrorDetail);
}
I found my problem. From: http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/13d3742d-4b6b-444e-840e-a4db11462a08
So I had Fiddler open the whole time I was writing / debugging. I closed Fiddler, and it worked the first time!