WL.logout()似乎什么都没做? [英] WL.logout() doesn't seem to do anything?

查看:85
本文介绍了WL.logout()似乎什么都没做?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

试图找出如何从我的网站中签署用户。 环顾论坛,这似乎是一个常见的问题,我没有看到任何类似的问题得到解答。 从我发现的情况来看,似乎仍然没有办法让
使用REST API登出用户。 所以我唯一的选择是JavaScript API,但似乎没有做任何事情。

Trying to figure out how to sign a user out of my site.  Looking around the forums, this appears to be a common problem and I don't see any similar questions having been answered.  From what I have found, it looks like there is still no way to log a user out using the REST API.  So my only option is the JavaScript API, but that doesn't appear to do anything.

我页面中的重要部分:

<script type="text/javascript">

function signUserOut(){

function signUserOut() {

WL.logout();

WL.logout();

警报('为什么不起作用??');

alert('why doesn't this work!?');

}

< / script>

</script>

< a href ="用户/ SignOut" onclick =" signUserOut()">退出< / a>

<a href="User/SignOut" onclick="signUserOut()">sign out</a>

弹出警告窗口,我假设WL.logout()已执行。然后调用我的SignOut操作,清除我网站的会话数据并重定向回主页。

The alert window pops up so I assume WL.logout() has executed. Then my SignOut action is called which clears the session data for my site and redirects back to the home page.

但是,如果我再次点击登录,最后一位用户无需输入电子邮件/密码即可直接签名。 为了确保WL.logout()正在执行,我使用相同的onclick方法创建了一个按钮,而忽略了服务器操作。 点击
它,没有任何反应。

However, if I click sign in again, the last user is signed right in without having to enter email/password.  To make sure WL.logout() was executing, I created a button instead with the same onclick method, leaving out the server action.  Click it, and nothing happens.

如何签署用户以便其他用户能够登录? 现在唯一的方法是,如果用户退出我的网站以及微软附属网站。

How do I sign users out so that another is able to sign in?  Right now the only way is if the user signs out of my site as well as a microsoft-affiliated site.

推荐答案

WL.logout是一个异步的方法,它将调用服务器调用。

WL.logout is an asynchronous method that will invoke a server call.

您的代码中的问题是< a>标记将触发浏览器在WL.logout完成之前导航到用户/注销。

The problem in your code is that the <a> tag will trigger the browser to navigate to user/signout before WL.logout complete.

您是否可以使用户/注销同步?或者在User / SignOut页面上调用WL.logout?

Can you make user/signout to be async as well? or invoke WL.logout on the User/SignOut page ?

谢谢,

Lin


这篇关于WL.logout()似乎什么都没做?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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