Azure Mobile client.logout不会在Ionic应用程序中注销用户

时间:2016-10-17 18:54:17

标签: cordova ionic-framework azure-mobile-services

我在Ionic应用程序中使用azure-mobile-apps-client库,我可以登录并轻松调用服务。但是,当我调用client.logout()时,用户不会被清除。

我可以等待client.logout()。然后(...并且看到client.currentUser现在为null。但是下次我调用client.login()时,用户自动登录而无需输入用户名或密码。弹出浏览器窗口只显示“您已成功登录”并返回新令牌。

不知何故,即使我退出,卸载应用程序,仍然不会要求重新部署用户重新输入密码!

有没有人知道我需要做什么才能使用Azure移动客户端注销用户?

谢谢!

2 个答案:

答案 0 :(得分:0)

client.logout()仅清除本地客户端的数据。该令牌由第三方签发,仍然有效。

如果您想要真正的注销,您需要实现客户端流认证并直接与客户端提供商打交道,然后再调用client.logout()。

您可以在我的博客中找到AAD客户端流程:https://shellmonger.com/2016/04/06/30-days-of-zumo-v2-azure-mobile-apps-day-4-adal-integration/

答案 1 :(得分:0)

不确定这是否应该如何完成,因为文档没有提到任何这一点。但这是我们最终做的事情:

var client = new WindowsAzure.MobileServiceClient(azureUrl);
client.logout().then(() => {

    var logoutUrl = "https://login.windows.net/common/oauth2/logout";

    var options = {
        hidden: 'yes',
        clearcache: 'yes'
    };

    this.rootScope.$on('$cordovaInAppBrowser:loadstop', function(e, event) {

        if (this.browser != null) {
            this.browser.close();
        }

    });

    this.browser.open(logoutUrl, '_blank', options);

}