Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix #415: catching-up with Umbraco fixes (doesn't need staging)

  • Loading branch information...
commit 23f1210f6bdc3b1d24ec0a8cb0729613743f9282 1 parent ef73776
Glenn Gailey ggailey777 authored
37 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-dotnet.md
View
@@ -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].
<div class="dev-callout"><b>Note</b>
- <p>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 <a href="/en-us/develop/mobile/tutorials/single-sign-on-win8-dotnet">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
+ <p>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 <a href="/en-us/develop/mobile/tutorials/single-sign-on-windows-8-dotnet">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
</div>
-<a name="register"></a><h2><span class="short-header">Register your app</span>Register your app for authentication and configure Mobile Services</h2>
+<h2><span class="short-header">Register your app</span><a name="register"></a>Register your app for authentication and configure Mobile Services</h2>
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.
-<a name="permissions"></a><h2><span class="short-header">Restrict permissions</span>Restrict permissions to authenticated users</h2>
+<h2><span class="short-header">Restrict permissions</span><a name="permissions"></a>Restrict permissions to authenticated users</h2>
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.
-<a name="add-authentication"></a><h2><span class="short-header">Add authentication</span>Add authentication to the app</h2>
+<h2><span class="short-header">Add authentication</span><a name="add-authentication"></a>Add authentication to the app</h2>
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.
20 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-ios.md
View
@@ -26,7 +26,7 @@ This tutorial is based on the Mobile Services quickstart. You must also first co
<p>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 <a href="/en-us/develop/mobile/tutorials/single-sign-on-win8-dotnet">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
</div>-->
-<a name="register"></a><h2><span class="short-header">Register your app</span>Register your app for authentication and configure Mobile Services</h2>
+<h2><span class="short-header">Register your app</span><a name="register"></a>Register your app for authentication and configure Mobile Services</h2>
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.
-<a name="permissions"></a><h2><span class="short-header">Restrict permissions</span>Restrict permissions to authenticated users</h2>
+<h2><span class="short-header">Restrict permissions</span><a name="permissions"></a>Restrict permissions to authenticated users</h2>
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.
-<a name="add-authentication"></a><h2><span class="short-header">Add authentication</span>Add authentication to the app</h2>
+<h2><span class="short-header">Add authentication</span><a name="add-authentication"></a>Add authentication to the app</h2>
-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
<p>If you are using an identity provider other than Facebook, change the value passed to <strong>loginViewControllerWithProvider</strong> above to one of the following: <i>microsoftaccount</i>, <i>facebook</i>, <i>twitter</i>, or <i>google</i>.</p>
</div>
-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.
26 DevCenter/Mobile/Tutorials/mobile-services-get-started-with-users-js.md
View
@@ -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].
<div class="dev-callout"><b>Note</b>
- <p>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 <a href="/en-us/develop/mobile/tutorials/single-sign-on-win8-js">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
+ <p>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 <a href="/en-us/develop/mobile/tutorials/single-sign-on-windows-8-js">Single sign-on for Windows Store apps by using Live Connect</a>.</p>
</div>
-<a name="register"></a><h2><span class="short-header">Register your app</span>Register your app for authentication and configure Mobile Services</h2>
+<h2><span class="short-header">Register your app</span><a name="register"></a>Register your app for authentication and configure Mobile Services</h2>
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.
-<a name="permissions"></a><h2><span class="short-header">Restrict permissions</span>Restrict permissions to authenticated users</h2>
+<h2><span class="short-header">Restrict permissions</span><a name="permissions"></a>Restrict permissions to authenticated users</h2>
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.
-<a name="add-authentication"></a><h2><span class="short-header">Add authentication</span>Add authentication to the app</h2>
+<h2><span class="short-header">Add authentication</span><a name="add-authentication"></a>Add authentication to the app</h2>
-1. Open the default.html project file and add the following &lt;script&gt; element in the &lt;head&gt; element.
-
- <script src="///LiveSDKHTML/js/wl.js"></script>
-
- 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.
-
- /// <reference path="///LiveSDKHTML/js/wl.js" />
-
- 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();
Please sign in to comment.
Something went wrong with that request. Please try again.