Follow these steps to get OAuth working in Windows Store applications (UWP).
- Go to Windows Dev Center
- Create a new application
- Once in app overview click on “App management” -> “App identity“
- Take note of the Package SID (starts with something like: S-1-15-2-more-numbers)
- Open the WebAuthenticationBroker sample from Windows 10 Samples on GitHub
- Right click on the project name and select “Store” -> “Associate App with the Store“
- Follow the steps until you see the application created in your Windows Dev Center to associate it with the current project.
- Open scenario1.js and change line 43 where it reads: scope=read_stream to scope=public_profile,email (or any other set of properties you want to access.)
- Register as Facebook developer
- Create a new application
- Go to “Settings” and click “Add Platform” -> “Windows App“
- In the Windows Store ID field enter the Package SID that you took note before (refer to step 4)
- Click “Save changes“
- Click on “Advanced” – tabs on the top of the page
- In the “Client OAuth Settings” make sure that “Client OAuth Login” is checked as “Yes“.
- Click on “Teat Apps” on the side menu.
- Click on “Create a Test App” and create a test application with the name of your choice.
- Once in the dashboard of the newly created application take note of the “App ID“.
- Click on “Roles” in the side menu.
- Click on “Test Users” -> “Add” -> “Create Test Users“.
- In the “Test Users” section click on “Edit” -> “Change the name or password for this user” and enter a password of your choice.
- Take note of the Test User’s email and password.
- Return to Visual Studio and run the application.
- Enter the App ID (refer to step 18) in the “Facebook App ID” field.
- Enter ms-app://Package SID (refer to step 4 to get the package SID) on the “Callback URL” field.
- Click on “Launch“.
- Enter the Facebook’s test user email and password (refer to step 22).
- Go to Google Developers Console (https://console.developers.google.com/)
- Create a new project
- In the “Use Google APIs” section click on “Enable and manage APIs“
- In the “Social APIs” section click on “Google+ API“.
- Click “Enable API“.
- Click “Credentials” in the side bar menu.
- Click “Add credentials” and then select “OAuth 2.0 client ID“.
- Click on “Configure consent screen“.
- Enter a product name and click “Save“.
- In the “Application type” select “Other” give it a name (e.g. “Windows Store App”) and click “Create“.
- Take note of the client ID.
- Go to Visual Studio and run the WebAuthenticationBroker application.
- Switch to the Google OAuth using the hamburger menu.
- Enter the Client ID (refer to step 11).
- Enter google credentials.
Note: If your project crashes around line 57:
on desktop or tablet make sure to change it to
if (Windows.Security.Authentication.Web.WebAuthenticationBroker.authenticateAndContinue && Windows.System.Profile.AnalyticsInfo.versionInfo.deviceFamily == "Windows.Mobile")