Getting Started
1. Create a new Universal Windows app or open an existing Universal Windows app.
2. Get the SID (Windows Store ID) for your application. Facebook uses the SID of your app as the ID for its redirect URI. You can get the ID for your published app via the process outlined at this URL, but this is not the SID your app will have prior to being signed and submitted to the store.
To get an SID during development, use the following:
using Windows.Security.Authentication.Web;
...
string SID = WebAuthenticationBroker.GetCurrentApplicationCallbackUri().ToString();
using namespace Windows::Security::Authentication::Web;
...
String^ SID = WebAuthenticationBroker::GetCurrentApplicationCallbackUri()->DisplayUri;
This will return "ms-app://SID"
3. Get the Windows Phone SID for your application
- Open the Package.appxmanifest file
- Look for mp:PhoneIdentity PhoneProductId="b19f9ff4-f0fe-4056..."
- Use the PhoneProductId without hyphens as the Windows Phone SID. In this case, it would be b19f9ff4-xxx
4. Create an app on developers.facebook.com and get an App ID
5. Add the Windows Store ID and Windows Phone Store ID to the Facebook app created.
- Select the created app on developers.facebook.com
- Click "Settings" from the menu on the left
- Click on the "Basic" tab.
- Click on "Add Platform" and select "Windows App"
- Enter the SID from Step 2 above in the Windows Store ID textbox.
- Enter the Windows Phone SID from 3 in Windows Phone Store ID textbox.
- Click on "Save Changes"
6. Enable OAuth login
- Select the created app on developers.facebook.com
- Click "Settings" from the menu on the left.
- Click on the "Advanced" tab.
- Under the "OAuth Settings" section, enable "Client OAuth Login" and "Embedded browser OAuth Login".
- Click on "Save Changes".
Building the SDK
For Universal Windows Applications for Windows 10 you can use the Nuget package within Visual Studio. Search for "winsdkfb" in the Nuget package explorer and install the package for your project. Alternatively you can grab the SDK directly from Github and add the following project to your solution- winsdkfb\winsdkfb\winsdkfb.Windows\winsdkfb.Windows.vcxproj
- winsdkfb\winsdkfb\winsdkfb.WindowsPhone\winsdkfb.WindowsPhone.vcxproj
Once you've added the projects to your solution, add a reference to them in your application references. Note that if you are using the following code snippets in C# functions, that the functions have to be marked with 'async' in order to compile and be used correctly.
You can view the MSDN docs on the await/async keywords here.There is also a blog post on how await/async is necessary with UI dialog boxes, similar to the Facebook auth dialog.