I’m trying to make an app that connects to Facebook in Visual Studio Express. The problem is that in this piece of code:
Windows.Security.Authentication.Web.Result WebAuthenticationResult = WebAuthenticationBroker.AuthenticateAsync(
WebAuthenticationOptions.None,
StartUri,
EndUri);
… I think I have implemented the method as shown in the samples but I keep getting the following error:
Error 1 Cannot implicitly convert type
‘Windows.Foundation.IAsyncOperation’
to
‘Windows.Security.Authentication.Web.WebAuthenticationResult’ R:\Users\JesúsAndres\Documents\Visual
Studio 2012\Projects\FBook\FBook\MainPage.xaml.cs 41 99 FBook
What am I doing wrong?
The AuthenticateAsync method doesn’t return the authentication result directly but an IAsyncOperation.
You can use the
awaitkeyword in C# to make the asynchronous call synchronous.See http://msdn.microsoft.com/en-us/library/hh156528.aspx and http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx for further information.