【发布时间】:2019-11-10 16:39:28
【问题描述】:
我的工作环境
- localhost 与 apache2.4
- 火狐浏览器
- Windows 10
这是我的控制台日志:
firefox console
为什么我在disconnect() 之后仍然登录?
只有在location.reload() 我退出后...为什么?
编辑: 此外:
- 在 Firefox 中打开新标签页,使用 oauth2 注册 myapp
- 然后我打开了新的浏览器标签myaccount.google.com/permissions 和 从 myapp 中删除了权限
- 已检查
hasGrantedScopes(SCOPE)myapp 正在运行的选项卡,并且仍然以 true 作为返回值 -
location.reload()在 myapp 运行的选项卡中 - 检查了运行 myapp 的
hasGrantedScopes(SCOPE)选项卡并得到 false 作为返回值
【问题讨论】:
-
尝试获取
.disconnect()函数的返回值,看看效果如何 -
我认为这对我没有帮助。该文档没有提到返回值。 developers.google.com/identity/sign-in/web/…我编辑了我的原始帖子并附加了一个控制台日志,其中包含 disconnect() 的返回值
-
大多数方法返回一个 Promise。您能否尝试在 console.log 之前添加一些延迟
-
@Thanh 我已经在这个 console.log 中做了。即使我在 disconnect() ... 后等待几分钟...仍然登录(hasGrantedScopes(SCOPE) 返回 true)。只有在 disconnect() 完成页面刷新后,hasGrantedScopes(SCOPE) 才会返回 false
-
@Thanh
GoogleAuth.disconnect().then(function (){console.log(gapi.auth2.getAuthInstance().currentUser.get().hasGrantedScopes(SCOPE));})返回值为 true 。还可以从我的主题问题中查看我的编辑
标签: javascript firefox youtube-api localhost disconnect