Teemu Tapanila bio photo

Teemu Tapanila

Microsoft Azure MVP and Windows Phone developer

Email Twitter Facebook Google+ LinkedIn Github Stackoverflow

Using Facebook single sign-on on Windows Phone 8 applications allows user very easy way to register/login to your application without filling forms. But it still requires user to enter Facebook login credentials to your application or Facebook web form. To avoid this you can use Facebook SSO (Single Sign On) which basically means that when you want to do authentication against Facebook on your application. You just redirect user to Facebook Windows Phone application where user can simply accept your application and whole authorization is done.

To use this feature you need to prepare your application with these steps:

  1. Create a new Windows Azure Mobile Service and follow this guide
  2. Open the visual studio project that you downloaded and edited on step 1
  3. Open WMAppManifest.xml on Code View
  4. Edit WMAppManifest by adding the Extensions and Protocol. Protocol name should be same as your ProductID without dashes and with msft- prefix
  5. Open Package Manager Console
  6. Run Install-Package Facebook.Client -pre
  7. Create new class called CustomURIMapper
  8. Here's all the code for the class
  9. Open App.xaml.cs and edit InitilizationPhoneApplication() method
  10. Edit MainPage.xaml.cs
  11. Go to Facebook developers and insert your windows phone application product ID without dashes into "Windows Phone Store ID" field

Now when user opens the app he will be redirected to Facebook for authenticating the app. Once he’s done he will be back into the application and authentication is done. If the user doesn’t have Facebook application installed he will be redirected to Windows Phone store to install it.

Complete solution can be found from Github

Any questions or comments?