0
votes

I am writing a Windows Phone 8 app which will use the Microsoft Account to authenticate a user (Via Azure Mobile Services)

I have followed the instructions here: http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-microsoft-authentication/

Everything works as expected I get a user ID token back from the service and I use this to identify the user's assets in my system.

Problem: Every time I run the App, It wants me to log in. Ticking the Keep Me Signed In check box when logging in just remembers the account email address. It always asked for the password.

Is there something I need to do to get the "Keep me signed in" to actually keep the user signed in for this application.

1

1 Answers

0
votes

This blog will walk you through how to fix that issue: http://www.thejoyofcode.com/Setting_the_auth_token_in_the_Mobile_Services_client_and_caching_the_user_rsquo_s_identity_Day_10_.aspx

You're going to have to manually ‘log the user in’ rather than using the provided login methods. To do this, set the user object on the Mobile Service client instance. (For more on generating an auth token, look here: http://www.thejoyofcode.com/Generating_your_own_ZUMO_auth_token_Day_8_.aspx)

In C#:

var mobileServiceClient = new MobileServiceClient("<your-app-url>", "<your-app-key>");
mobileServiceClient.CurrentUser = new MobileServiceUser("Foo:123456789");
mobileServiceClient.CurrentUser.MobileServiceAuthenticationToken = "<your-users-JWT>";

In JS:

var client = new Microsoft.WindowsAzure.MobileServices.MobileServiceClient(
    "<your-app-url>",
    "<your-app-key>");

client.currentUser = {
    userId: "Foo:123456789",
    mobileServiceAuthenticationToken: "<your-users-JWT>"
};