Bitesized tidbits for building Modern (Metro) apps.
Tag Archives: Facebook
December 16, 2015Posted by on
For a while now, there have been a few ways for developers to allow a user to sign into Facebook:
- They could use the WebAuthenticationBroker, which launched a hosted window the user could enter their details in;
- They could use their own hosted WebView (WebBrowser on Silverlight) and send the user to the same place as the WebAuthenticationBroker and handle the navigations themselves;
- They could use the Facebook Client SDK (in Silverlight), or the Windows SDK for Facebook (in Universal apps);
- Manually create the URI scheme that would launch the Facebook app and have the app do the authentication for you.
With Windows 10, there’s a new way for developers to be able to authenticate their users, and that’s the WebAccountProvider. This allows account providers (like Facebook) to provide authentication using their Windows 10 app. Using this approach would mean your users would never have to leave the comfort of your app to get authenticated.
So what does all this mean? What is WebAccountProvider? It’s possible, in Windows 10, for apps to allow developers to explicitly use them as an authentication provider, without having to use URI schemes and callbacks to be set up by the calling app. The difference between this approach and the URI/Callback approach is this can be done silently so the user can potentially never leave your app but still get successfully authenticated.
All of this blog post is based on the current Windows 10 Facebook beta that came out recently. If you submit a Windows 10 app to the store before this version leaves beta, this code will not work as the user will likely be using the non-beta Facebook app. If you only depend on this approach, then your users will not be able to authenticate with Facebook, so it’s important to have some fallback methods.
This is now available in the non-beta version of Facebook for Windows 10 too, so will work for anyone who has updated their app.