如何注销 chrome.identity oauth 提供程序 [英] How do I log out of a chrome.identity oauth provider

查看:26
本文介绍了如何注销 chrome.identity oauth 提供程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 chrome.identity 登录 chrome 扩展程序中的第 3 方 oauth 提供商.它适用于登录 - 当我使用 launchWebAuthFlow 时,我会看到第三方登录屏幕并重定向登录流程后返回我的应用程序.

I'm using chrome.identity to log into a 3rd party oauth provider in an chrome extension. It works fine for logging in- when I use launchWebAuthFlow I am presented with the third party login screen and redirected back to my application after the signin flow.

但是,我找不到在我的扩展程序中启用注销功能的方法.似乎没有清除缓存的登录身份的功能.下次调用launchWebAuthFlow时,它会自动以第一个用户身份登录,不再提示我再次登录.

However, I can't find a way to enable log out functionality in my extension. There doesn't seem to be a function to clear the cached logged in identity. The next time that launchWebAuthFlow is called, it will automatically log me in as the first user, and not prompt me to log in again.

有什么办法可以清除chrome.identity插件的登录状态?

Is there any way to clear the logged in state of the chrome.identity plugin?

推荐答案

我不知道具体的第三方提供商.但是我在使用带有 chrome.identity.launchWebAuthFlow() 的 Google Oauth 时遇到了类似的问题.我可以登录用户,但不能使用 removeCachedAuthToken() 注销

I am not aware about the specific third party provider. But I faced the similar problem when using Google Oauth with chrome.identity.launchWebAuthFlow(). I could sign in the user, but not sign out using removeCachedAuthToken()

在这种情况下,为了注销用户,我使用 chrome.identity.launchWebAuthFlow() 和 Google 的注销 URL 而不是 oauth URL

In this case, to logout the user, I used chrome.identity.launchWebAuthFlow() with Google's logout URL rather than it's oauth URL

chrome.identity.launchWebAuthFlow(
    { 'url': 'https://accounts.google.com/logout' },
    function(tokenUrl) {
        responseCallback();
    }
);

效果很好.

这篇关于如何注销 chrome.identity oauth 提供程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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