的Windows Phone 8的Azure移动服务 - 保持登录(微软账户) [英] Windows Phone 8 Azure Mobiles Services - Keep me signed in (Microsoft Account)

查看:133
本文介绍了的Windows Phone 8的Azure移动服务 - 保持登录(微软账户)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写的Windows Phone 8应用程序,它会使用Microsoft帐户验证用户​​(通过的Azure移动服务)

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

我按照这里的说明:<一href="http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-microsoft-authentication/" rel="nofollow">http://www.windowsazure.com/en-us/develop/mobile/how-to-guides/register-for-microsoft-authentication/

一切正常,我得到一个用户ID从服务令牌回来,我用它来识别用户的资产在我的系统。

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.

推荐答案

本博客将引导您如何解决这个问题:<一href="http://www.thejoyof$c$c.com/Setting_the_auth_token_in_the_Mobile_Services_client_and_caching_the_user_rsquo_s_identity_Day_10_.aspx" rel="nofollow">http://www.thejoyof$c$c.com/Setting_the_auth_token_in_the_Mobile_Services_client_and_caching_the_user_rsquo_s_identity_Day_10_.aspx

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

你将不得不手动登录用户,而不是利用所提供的登录方法。要做到这一点,设置在移动服务客户端实例的用户对象。 (欲了解更多关于生成身份验证令牌,请看这里: HTTP://www.thejoyof$c $ c.com / Generating_your_own_ZUMO_auth_token_Day_8_.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)

在C#:<​​/ P>

In C#:

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

在JS:

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

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

这篇关于的Windows Phone 8的Azure移动服务 - 保持登录(微软账户)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆