Therefore, the change that will make the right oAuth UI to come up and ask the user to authorize the app to make changes to SkyDrive is to remove the scope from the WL.ui() call and add it to the WL.init() call, as follows:

WL.init({
scope: "wl.signin wl.skydrive_update",
});

Running the application before this change will authorize the app to sign-in to your Microsoft account but not to access your SkyDrive. After this change the Connect button will prompt authorization to access and modify SkyDrive, and getting the count by pressing the Get Count button will work as expected.