gpt4 book ai didi

.net - 使用 Twitter 通过 Azure 移动服务重新进行身份验证

转载 作者:行者123 更新时间:2023-12-03 04:38:01 24 4
gpt4 key购买 nike

我正在结合 Azure 移动服务构建 WP8 应用程序。我使用 Twitter 作为 Azure 的身份验证方法。所以我使用下面的代码来登录:

user = await Client.LoginAsync(MobileServiceAuthenticationProvider.Twitter);

其中 Client 是我的 MobileServiceClient。

执行时,这会触发 Web 浏览器打开并让用户登录等。之后,“用户”对象就被成功填充。 (.UserId)。

但是,我希望此登录只发生一次。因为用户下次打开应用时,需要重新登录。

另一个线程( here )中提到的建议建议我使用之前获得的数据自己构建用户对象,如下所示:

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

但这在 WP8 中是不可能的... MobileServiceUser 没有带有 1 个参数的构造函数,当构造空用户时,UserId 属性是只读的。而且 MobileServiceAuthenticationToken 也不可用。所以这个方法行不通。

我对 Twitter 的身份验证本身有效,我通过 user.getIdentities 获得了 accessToken 和 accessTokenSecret,所以需要明确的是,问题是我的 azure 移动服务的用户身份验证。

还有其他建议吗?提前致谢!

最佳答案

使用新的 NuGet 包 - http://nuget.org/packages/windowsazure.mobileservices

安装包 WindowsAzure.MobileServices -Pre

注意:在发布时,此 NuGet 处于预发行版。

关于.net - 使用 Twitter 通过 Azure 移动服务重新进行身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16252904/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com