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

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

问题描述

我使用 chrome.identity 以chrome扩展程序登录第三方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.

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

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?

推荐答案

我不知道具体的第三方供应商。但是,在使用Google Oauth和chrome.identity.launchWebAuthFlow()时,我遇到了类似的问题。我可以登录用户,但不能使用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天全站免登陆