是LoginAsync返回是相同的MobileServiceClient.CurrentUser令牌LoginAsync和MobileServiceUser的令牌后? [英] Is the token in MobileServiceClient.CurrentUser after LoginAsync and token of MobileServiceUser returned by LoginAsync are the same?

查看:208
本文介绍了是LoginAsync返回是相同的MobileServiceClient.CurrentUser令牌LoginAsync和MobileServiceUser的令牌后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在此<一个href=\"https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-android-get-started-users/\"相对=nofollow>指南,一个MobileUser呼吁MobileServiceClient.LoginAsync后设置。我想,通过MobileServiceClient.LoginAsync返回的MobileUser是一样的MobileServiceClient.CurrentUser通过LoginAsync登录后。

In this guide, a MobileUser is set after calling MobileServiceClient.LoginAsync. I'm thinking that the MobileUser returned by MobileServiceClient.LoginAsync is the same as the MobileServiceClient.CurrentUser after logging in via LoginAsync.

我通过调用MobileServiceAuthenticationToken财产(即MobileUser.MobileServiceAuthenticationToken和MobileService.CurrentUser.MobileServiceAuthenticationToken)打印出来,无论它们所包含的令牌。

I printed out both the tokens they contain by calling the MobileServiceAuthenticationToken property (i.e. MobileUser.MobileServiceAuthenticationToken and MobileService.CurrentUser.MobileServiceAuthenticationToken).

的两个令牌似乎是相同的。这两个标记具有相同的有效载荷在 jwt.io 德codeD我崇高的文本2还粘贴两个令牌而所说的编辑器识别出两个记号一样因为使用CTRL + D也可以选择其他的标记。

The two tokens seem to be the same. The two tokens have the same payload as decoded in jwt.io I also pasted both tokens in Sublime Text 2 and the said editor recognizes the two tokens as the same since using ctrl+D also selects the other token.

它是安全的假设,两个标记是相同的,这两个MobileServiceUsers是一样的吗?

Is it safe to assume that the two tokens are the same and the two MobileServiceUsers are the same?

这可能看起来像一个奇怪的问题,但我试图调试客户端code问题,需要检查,这是因为从导改变code的不是。

This might look like a weird question but i'm trying to debug a problem in the client code and need to check that it's not because of changing the code from the guide.

推荐答案

是的,令牌是一样的。成功登录后,的currentUser,填入您的通话LoginAsync的结果。这允许您服务的所有后续调用包括令牌并允许您访问的currentUser细节,而无需存储的信息自己。

Yes, the tokens are the same. After a successful login, the CurrentUser is populated with the results of your LoginAsync call. This allows all subsequent calls to your service to include the token and lets you access the CurrentUser details without needing to store that info yourself.

下面是在C#的客户端,这是否在code:<一href=\"https://github.com/Azure/azure-mobile-apps-net-client/blob/master/sdk/src/Microsoft.WindowsAzure.MobileServices/Authentication/MobileServiceAuthentication.cs#L148\" rel=\"nofollow\">https://github.com/Azure/azure-mobile-apps-net-client/blob/master/sdk/src/Microsoft.WindowsAzure.MobileServices/Authentication/MobileServiceAuthentication.cs#L148

Here's the code in the C# client that does this: https://github.com/Azure/azure-mobile-apps-net-client/blob/master/sdk/src/Microsoft.WindowsAzure.MobileServices/Authentication/MobileServiceAuthentication.cs#L148

这篇关于是LoginAsync返回是相同的MobileServiceClient.CurrentUser令牌LoginAsync和MobileServiceUser的令牌后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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