From 23f1210f6bdc3b1d24ec0a8cb0729613743f9282 Mon Sep 17 00:00:00 2001 From: ggailey777 Date: Mon, 15 Oct 2012 17:46:41 -0700 Subject: [PATCH 1/5] fix #415: catching-up with Umbraco fixes (doesn't need staging) --- ...-services-get-started-with-users-dotnet.md | 37 ++++++++----------- ...ile-services-get-started-with-users-ios.md | 20 +++------- ...bile-services-get-started-with-users-js.md | 26 ++++--------- 3 files changed, 29 insertions(+), 54 deletions(-) diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md index d2ff79197ea..132c43c3af7 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md @@ -21,10 +21,10 @@ This tutorial walks you through these basic steps to enable authentication in yo This tutorial is based on the Mobile Services quickstart. You must also first complete the tutorial [Get started with Mobile Services].
Note -

This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic Single sign-on for Windows Store apps by using Live Connect.

+

This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic Single sign-on for Windows Store apps by using Live Connect.

-

Register your appRegister your app for authentication and configure Mobile Services

+

Register your appRegister your app for authentication and configure Mobile Services

To be able to authenticate users, you must register your app with an identity provider. You must then register the provider-generated client secret with Mobile Services. @@ -51,7 +51,7 @@ To be able to authenticate users, you must register your app with an identity pr Both your mobile service and your app are now configured to work with your chosen authentication provider. -

Restrict permissionsRestrict permissions to authenticated users

+

Restrict permissionsRestrict permissions to authenticated users

1. In the Management Portal, click the **Data** tab, and then click the **TodoItem** table. @@ -69,7 +69,7 @@ Both your mobile service and your app are now configured to work with your chose Next, you will update the app to authenticate users before requesting resources from the mobile service. -

Add authenticationAdd authentication to the app

+

Add authenticationAdd authentication to the app

5. Open the project file mainpage.xaml.cs and add the following using statement: @@ -82,28 +82,23 @@ Next, you will update the app to authenticate users before requesting resources { while (user == null) { - - user = await App.MobileService - .LoginAsync( - MobileServiceAuthenticationProvider.Facebook); - if (user.UserId != null) + string message; + try { - - var message = + user = await App.MobileService + LoginAsync(MobileServiceAuthenticationProvider.Facebook); + message = string.Format("You are now logged in - {0}", user.UserId); - var dialog = new MessageDialog(message); - dialog.Commands.Add(new UICommand("OK")); - await dialog.ShowAsync(); } - else + catch (InvalidOperationException) { - user = null; - var dialog = - new MessageDialog("You must log in.", "Login Required"); - dialog.Commands.Add(new UICommand("OK")); - await dialog.ShowAsync(); + message = "You must log in. Login Required"; } - } + + var dialog = new MessageDialog(message); + dialog.Commands.Add(new UICommand("OK")); + await dialog.ShowAsync(); + } } This creates a member variable for storing the current user and a method to handle the authentication process. The user is authenticated by using a Facebook login. diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md index 012b65db98d..e94b09c9447 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md @@ -26,7 +26,7 @@ This tutorial is based on the Mobile Services quickstart. You must also first co

This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic Single sign-on for Windows Store apps by using Live Connect.

--> -

Register your appRegister your app for authentication and configure Mobile Services

+

Register your appRegister your app for authentication and configure Mobile Services

To be able to authenticate users, you must register your app with an identity provider. You must then register the provider-generated client secret with Mobile Services. @@ -53,7 +53,7 @@ To be able to authenticate users, you must register your app with an identity pr Both your mobile service and your app are now configured to work with your chosen authentication provider. -

Restrict permissionsRestrict permissions to authenticated users

+

Restrict permissionsRestrict permissions to authenticated users

1. In the Management Portal, click the **Data** tab, and then click the **TodoItem** table. @@ -71,23 +71,15 @@ Both your mobile service and your app are now configured to work with your chose Next, you will update the app to authenticate users before requesting resources from the mobile service. -

Add authenticationAdd authentication to the app

+

Add authenticationAdd authentication to the app

-5. Open the project file TodoListController.m and in the **@interface TodoListController** declaration block, add the following code: - - @property (strong, nonatomic) TodoService *todoService; - -6. In the **@interface TodoListController** declaration block, add the following code: - - @synthesize todoService; - -7. In the **viewDidLoad** method, remove the following code that reloads the data into the table: +1. Open the project file TodoListController.m and in the **viewDidLoad** method, remove the following code that reloads the data into the table: [todoService refreshDataOnSuccess:^{ [self.tableView reloadData]; }]; -7. Just after the **viewDidLoad** method, add the following code: +2. Just after the **viewDidLoad** method, add the following code: - (void)viewDidAppear:(BOOL)animated { @@ -131,7 +123,7 @@ Next, you will update the app to authenticate users before requesting resources

If you are using an identity provider other than Facebook, change the value passed to loginViewControllerWithProvider above to one of the following: microsoftaccount, facebook, twitter, or google.

-9. Press the **Run** button to build the project, start the app in the iPhone emulator, then log-on with your chosen identity provider. +3. Press the **Run** button to build the project, start the app in the iPhone emulator, then log-on with your chosen identity provider. When you are successfully logged-in, the app should run without errors, and you should be able to query Mobile Services and make updates to data. diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-js.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-js.md index 90cf05761a9..e05c3e8b036 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-js.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-js.md @@ -21,10 +21,10 @@ This tutorial walks you through these basic steps to enable authentication in yo This tutorial is based on the Mobile Services quickstart. You must also first complete the tutorial [Get started with Mobile Services].
Note -

This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic Single sign-on for Windows Store apps by using Live Connect.

+

This tutorial demonstrates the basic method provided by Mobile Services to authenticate users by using a variety of identity providers. This method is easy to configure and supports multiple providers. However, this method also requires users to log-in every time your app starts. To instead use Live Connect to provide a single sign-on experience in your Windows Store app, see the topic Single sign-on for Windows Store apps by using Live Connect.

-

Register your appRegister your app for authentication and configure Mobile Services

+

Register your appRegister your app for authentication and configure Mobile Services

To be able to authenticate users, you must register your app with an identity provider. You must then register the provider-generated client secret with Mobile Services. @@ -51,7 +51,7 @@ To be able to authenticate users, you must register your app with an identity pr Both your mobile service and your app are now configured to work with your chosen authentication provider. -

Restrict permissionsRestrict permissions to authenticated users

+

Restrict permissionsRestrict permissions to authenticated users

1. In the Management Portal, click the **Data** tab, and then click the **TodoItem** table. @@ -69,28 +69,16 @@ Both your mobile service and your app are now configured to work with your chose Next, you will update the app to authenticate users before requesting resources from the mobile service. -

Add authenticationAdd authentication to the app

+

Add authenticationAdd authentication to the app

-1. Open the default.html project file and add the following <script> element in the <head> element. - - - - This enables Microsoft IntelliSense in the default.html file. - -5. Open the project file default.js and add the following comment to the top of the file. - - /// - - This enables Microsoft IntelliSense in the default.js file. - -5. In the **app.OnActivated** method overload, replace the call to the **refreshTodoItems** method with the following code: +1. Open the project file default.js and in the **app.OnActivated** method overload, replace the call to the **refreshTodoItems** method with the following code: var userId = null; // Request authentication from Mobile Services using a Facebook login. var login = function () { return new WinJS.Promise(function (complete) { - client.login("facebook").done(function (results) {; + mobileService.login("facebook").done(function (results) {; userId = results.userId; refreshTodoItems(); var message = "You are now logged in as: " + userId; @@ -107,7 +95,7 @@ Next, you will update the app to authenticate users before requesting resources var authenticate = function () { login().then(function () { - if (user === null) { + if (userId === null) { // Authentication failed, try again. authenticate(); From 8b5d6e25ff539343b372543570f2cde38939e184 Mon Sep 17 00:00:00 2001 From: ggailey777 Date: Mon, 15 Oct 2012 17:57:55 -0700 Subject: [PATCH 2/5] fix #415: URGENT added a missing insert step to the iOS tutorial --- .../mobile-services-get-started-with-data-ios.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md index 8d95c41c6ca..ece1501c095 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md @@ -201,7 +201,20 @@ Now that your mobile service is ready, you can update the app to store items in completion(); }]; -13. Locate the **completeItem** method, and replace the body of the method with the following code: +13. Locate the **addItem** method, and replace the body of the method with the following code: + + // Insert the item into the TodoItem table and add to the items array on completion + [self.table insert:item completion:^(NSDictionary *result, NSError *error) { + NSUInteger index = [items count]; + [(NSMutableArray *)items insertObject:item atIndex:index]; + + // Let the caller know that we finished + completion(index); + }]; + + This code send an insert request to the mobile service. + +14. Locate the **completeItem** method, and replace the body of the method with the following code: // Update the item in the TodoItem table and remove from the items array on completion [self.table update:mutable completion:^(NSDictionary *item, NSError *error) { From f82d4f2155615b085308c6982cba19848ad880df Mon Sep 17 00:00:00 2001 From: ggailey777 Date: Mon, 15 Oct 2012 18:04:53 -0700 Subject: [PATCH 3/5] fix #415: typo --- .../Tutorials/mobile-services-get-started-with-data-ios.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md index ece1501c095..80f5db4861b 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md @@ -212,7 +212,7 @@ Now that your mobile service is ready, you can update the app to store items in completion(index); }]; - This code send an insert request to the mobile service. + This code sends an insert request to the mobile service. 14. Locate the **completeItem** method, and replace the body of the method with the following code: From 32efc3dab9baa259e6de16350af0da49379fd107 Mon Sep 17 00:00:00 2001 From: ggailey777 Date: Mon, 15 Oct 2012 23:32:04 -0700 Subject: [PATCH 4/5] fix #415: fixed double-quote code bug in users-ios tutorial --- .../Tutorials/mobile-services-get-started-with-data-ios.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md index 80f5db4861b..ba3142aa80f 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md @@ -162,7 +162,7 @@ Now that your mobile service is ready, you can update the app to store items in After this comment, add the following line of code: - self.client = [MSClient clientWithApplicationURLString:@”APPURL” withApplicationKey:@"APPKEY"]; + self.client = [MSClient clientWithApplicationURLString:@"APPURL" withApplicationKey:@"APPKEY"]; This creates an instance of the Mobile Services client. From 5a30619b439caa7cf84f816d12556517629f1717 Mon Sep 17 00:00:00 2001 From: ggailey777 Date: Thu, 18 Oct 2012 09:45:55 -0700 Subject: [PATCH 5/5] fix #446: added platform disclaimer to iOS --- .../mobile-services-get-started-ios.md | 4 +++- ...bile-services-get-started-with-data-ios.md | 20 +++++++++---------- ...-services-get-started-with-users-dotnet.md | 2 +- ...ile-services-get-started-with-users-ios.md | 2 ++ .../Tutorials/mobile-services-get-started.md | 2 +- 5 files changed, 17 insertions(+), 13 deletions(-) diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-ios.md index 76cc4b6e302..f82746e0262 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-ios.md @@ -16,10 +16,12 @@ A screenshot from the completed app is below: ![][0] -Completing this guide is a prerequisite for all other Mobile Services tutorials for iOS apps. +Completing this tutorial requires XCode 4.5 and iOS 5.0 or later versions.
+Completing this tutorial is a prerequisite for all other Mobile Services tutorials for iOS apps. +
Note

To complete this tutorial, you need a Windows Azure account that has the Windows Azure Mobile Services feature enabled. You can create a free trial account and enable preview features in just a couple of minutes. For details, see Create a Windows Azure account and enable preview features.

diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md index ba3142aa80f..f0610ce28f9 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-data-ios.md @@ -26,7 +26,7 @@ This tutorial walks you through these basic steps: 4. [Update the app to use Mobile Services] 5. [Test the app against Mobile Services] -This tutorial requires the [Mobile Services iOS SDK] and [XCode 4.5][Install Xcode] or a later version. +This tutorial requires the [Mobile Services iOS SDK] and [XCode 4.5][Install Xcode] and iOS 5.0 or later versions. ##

Download the projectDownload the GetStartedWithData project

@@ -148,15 +148,15 @@ Now that your mobile service is ready, you can update the app to store items in This creates a property representation for your mobile services table. -6. In the Management Portal, click **Mobile Services**, and then click the mobile service you just created. +5. In the Management Portal, click **Mobile Services**, and then click the mobile service you just created. -7. Click the **Dashboard** tab and make a note of the **Site URL**, then click **Manage keys** and make a note of the **Application key**. +6. Click the **Dashboard** tab and make a note of the **Site URL**, then click **Manage keys** and make a note of the **Application key**. ![][8] You will need these values when accessing the mobile service from your app code. -8. Back in Xcode, open TodoService.m and locate the following commented line of code: +7. Back in Xcode, open TodoService.m and locate the following commented line of code: // Initialize the Mobile Service client with your URL and key. @@ -166,9 +166,9 @@ Now that your mobile service is ready, you can update the app to store items in This creates an instance of the Mobile Services client. -9. Replace the values of **APPURL** and **APPKEY** in this code with the URL and application key from the mobile service that you acquired in step 6. +8. Replace the values of **APPURL** and **APPKEY** in this code with the URL and application key from the mobile service that you acquired in step 6. -10. Locate the following commented line of code: +9. Locate the following commented line of code: // Create an MSTable instance to allow us to work with the TodoItem table. @@ -178,7 +178,7 @@ Now that your mobile service is ready, you can update the app to store items in This creates the TodoItem table instance. -11. Locate the following commented line of code: +10. Locate the following commented line of code: // Create a predicate that finds items where complete is false comment in the refreshDataOnSuccess method. @@ -188,7 +188,7 @@ Now that your mobile service is ready, you can update the app to store items in This creates a query to return all tasks that have not yet been completed. -12. Locate the following commented line of code: +11. Locate the following commented line of code: // Query the TodoItem table and update the items property with the results from the service. @@ -201,7 +201,7 @@ Now that your mobile service is ready, you can update the app to store items in completion(); }]; -13. Locate the **addItem** method, and replace the body of the method with the following code: +12. Locate the **addItem** method, and replace the body of the method with the following code: // Insert the item into the TodoItem table and add to the items array on completion [self.table insert:item completion:^(NSDictionary *result, NSError *error) { @@ -214,7 +214,7 @@ Now that your mobile service is ready, you can update the app to store items in This code sends an insert request to the mobile service. -14. Locate the **completeItem** method, and replace the body of the method with the following code: +13. Locate the **completeItem** method, and replace the body of the method with the following code: // Update the item in the TodoItem table and remove from the items array on completion [self.table update:mutable completion:^(NSDictionary *item, NSError *error) { diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md index 132c43c3af7..a25015ce777 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md @@ -86,7 +86,7 @@ Next, you will update the app to authenticate users before requesting resources try { user = await App.MobileService - LoginAsync(MobileServiceAuthenticationProvider.Facebook); + .LoginAsync(MobileServiceAuthenticationProvider.Facebook); message = string.Format("You are now logged in - {0}", user.UserId); } diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md index e94b09c9447..1349ffb4d11 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md @@ -22,6 +22,8 @@ This tutorial walks you through these basic steps to enable authentication in yo This tutorial is based on the Mobile Services quickstart. You must also first complete the tutorial [Get started with Mobile Services]. +Completing this tutorial requires XCode 4.5 and iOS 5.0 or later versions. + diff --git a/DevCenter/Mobile/Tutorials/mobile-services-get-started.md b/DevCenter/Mobile/Tutorials/mobile-services-get-started.md index 8fc7ba670bd..21b759d2f62 100644 --- a/DevCenter/Mobile/Tutorials/mobile-services-get-started.md +++ b/DevCenter/Mobile/Tutorials/mobile-services-get-started.md @@ -15,7 +15,7 @@ A screenshot from the completed app is below: ![][0] -Completing this guide is a prerequisite for all other Mobile Services tutorials for Windows Store apps. +Completing this tutorial is a prerequisite for all other Mobile Services tutorials for Windows Store apps.