Register your app on Facebook
Click on Create New App in the upper right corner and give your app a name.
Once the app is created, expand the Website with Facebook Login under Select how your app integrates with Facebook. In the Site Url text box, type the URL of your mobile service. If you don’t remember it, go back to the management portal, select your mobile service, and go to the dashboard section. You’ll find the URL in the right pane.
Go back to the management portal, select your mobile services and click Identity in the navigation pane. In this section, you can configure your mobile service to make it work with authentication providers (Microsoft, Facebook, Twitter and Google). Type the Facebook App ID and App Secret under the Facebook settings section.
{
this.InitializeComponent();
this.Loaded += MainPage_Loaded;
}
async void MainPage_Loaded(object sender, RoutedEventArgs e)
{
try
{
var user = await App.MobileService.LoginAsync(MobileServiceAuthenticationProvider.Facebook);
MessageDialog md = new MessageDialog("Authentication succeeded");
await md.ShowAsync();
}
catch (Exception)
{
MessageDialog md = new MessageDialog("Authentication failed");
md.ShowAsync();
}
}