Google Openid:这是可以接受的注销方法吗? [英] Google Openid: Is this an acceptable way to logout?

查看:118
本文介绍了Google Openid:这是可以接受的注销方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的网站上使用google open id作为登录系统. 我在注销用户时遇到了一些麻烦.显然,在网站上销毁会话不会使他们注销google帐户,并且在下次登录时,用户会使用浏览器登录的任何google帐户自动登录.

I am using google open id on my website as a login system. I ran into some trouble with logging a user out. Destroying the session on the site obviously doesn't log them out of the google account, and on the next login the user automatically logs in with whatever google account the browser is logged into.

看着这里的几个问题,我发现我可以向 https://www.google.com/accounts/Logout

Looking at a few questions on here, I discovered I could just make a request to https://www.google.com/accounts/Logout

我尝试使用

<script type="text/javascript">
    $.ajax({ url: "https://www.google.com/accounts/Logout" });
</script>

但是它不起作用,我不确定为什么.但这很好用

but it did not work and I'm not sure why. However this works just fine

<img src="https://www.google.com/accounts/Logout" />

有人可以向我解释为什么ajax请求不起作用吗?

Can anyone explain to me why the ajax request doesn't work?

更重要的是,发送请求的最佳方法是什么? img标签似乎不是一个很好的解决方案. 谢谢

More importantly, what is the best way to send the request? An img tag doesn't seem like a nice solution. Thanks

推荐答案

您不能使用jQuery的$.ajax进行跨域请求,请参见相同的原产地政策,这就是为什么您的第一个解决方案不起作用的原因.

You cannot make cross-domain requests using jQuery's $.ajax, see Same origin policy so that is why your first solution does not work.

编辑:我不熟悉Google OpenID的工作原理,但是作为用户,当我要注销该应用程序时,我不会使用将我从Google注销的应用程序;那是糟糕的用户体验.

I am not familiar with how Google's OpenID works, but as a user I would not use an app that logs me out of Google when I want to logout of the app; that's a bad user experience.

这篇关于Google Openid:这是可以接受的注销方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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