【问题标题】:With Azure Mobile Services, microsoftaccount erroring and twitter not sticking使用 Azure 移动服务,microsoftaccount 错误和 twitter 不粘
【发布时间】:2014-05-29 00:16:55
【问题描述】:

我相信我已按照所有正确的说明设置我的 microsoft oauth2 帐户,但我收到一条错误消息,说明我在下面粘贴的内容。如何调试?此外,当我使用 google 或 facebook 进行 oauth 时,下一次通过时我没有收到提示(我假设设置了 cookie)。当我使用推特时,它每次都会提示我。这是预期的行为吗?

仅供参考,我的简单代码如下。

我们无法完成您的请求 Microsoft 帐户遇到技术问题。请稍后再试。

var client = new WindowsAzure.MobileServiceClient('https://xxx.azure-mobile.net/', 'xxxx');

    $(document).ready(function () {
        $("#submit1").click(function () {
            client.login("google").done(function (results) {
                console.log(results);
                alert("You are now logged in as google: " + results.userId);
            }, function (err) {
                alert("Error: " + err);
            });
        });

        $("#submit2").click(function () {
            client.login("twitter").done(function (results) {
                console.log(results);
                alert("You are now logged in as twitter: " + results.userId);
            }, function (err) {
                alert("Error: " + err);
            });
        });

        $("#submit3").click(function () {
            client.login("facebook").done(function (results) {
                console.log(results);
                alert("You are now logged in as facebook: " + results.userId);
            }, function (err) {
                alert("Error: " + err);
            });
        });

        $("#submit4").click(function () {
            client.login("microsoftaccount").done(function (results) {
                console.log(results);
                alert("You are now logged in as microsoftaccount: " + results.userId);
            }, function (err) {
                alert("Error: " + err);
            });
        });
    });

【问题讨论】:

  • 您使用的是什么后端以及您指定的重定向 URL 是什么?到目前为止,错误是我见过的最常见的原因,它会让您看到“技术问题”问题。

标签: azure oauth-2.0 azure-mobile-services


【解决方案1】:

对于 twitter:您需要在应用程序的“设置”选项卡中的https://dev.twitter.com 下选中“允许此应用程序用于使用 Twitter 登录”选项(见下图)。如果未选择该选项,您仍然可以使用 twitter 登录移动服务,但它不会记住用户。

对于 microsoft 帐户:您能否检查您是否已按照http://azure.microsoft.com/en-us/documentation/articles/mobile-services-how-to-register-microsoft-authentication/ 中所述的确切步骤进行操作?我发现每隔一段时间我就会错过一个步骤,它会给我一个像你得到的错误一样的一般错误。

【讨论】:

  • 卡洛斯,很高兴见到你!您在撰写有关此主题的文章方面非常多产。 Twitter 确实有效,是的,我第一次确实忘记选中该框。 microsoftaccount 是我唯一的问题。当前屏幕还有一个 storeid 文本字段,我将其留空。我认为这是针对推送通知之类的。否则,在 Microsoft 方面,我只能看到两个要设置的文本框。
  • 嗨,Peter,您能否就您在使用 Microsoft 帐户登录时遇到的问题添加更多详细信息?我尝试了该教程中的步骤,并且效果很好。带有“storyid”文本字段的“当前屏幕”是什么意思?
  • 我使用我的一个 msdn 事件来解决它(以及围绕 azure 移动服务的其他问题)。原来我的重定向是错误的。我没有使用 /../microsoftaccount 而是其他东西。
猜你喜欢
  • 2018-01-29
  • 2016-11-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-02-17
  • 2017-06-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多