如何从扩展程序中撤消Google帐户访问权限 [英] How to revoke Google account access from within an extension

查看:101
本文介绍了如何从扩展程序中撤消Google帐户访问权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Chrome浏览器扩展程序,该扩展程序使用chrome.identity.getAuthToken请求访问,并且运行正常.在扩展程序中,您可以使用以下方式注销:

I have a Chrome browser extension that requests access using chrome.identity.getAuthToken, and is working as expected. In the extension you can logout using:

var do_logout = function() {
    chrome.identity.getAuthToken({'interactive': false}, function(token) {
        chrome.identity.removeCachedAuthToken({token:token}, function(){
            display_login();
        });
    });
};

这又能正常工作.问题是当您重新登录时.理想情况下,我希望扩展程序再次请求权限-主要是从不同的帐户进行测试-但即使当我请求使用Interactive = true进行登录时,我也不会获得交互式UI,如下所示:

Which again is working fine. The issue is when you log back in. Ideally I want the extension to ask for permission again - mainly for testing from different accounts - but even when I request a login with interactive=true I don't get the interactive UI, like this:

chrome.identity.getAuthToken({'interactive': true }, function(token) {

我可以登录我的 Google帐户页面,然后从那里撤消访问权限,但这有点感觉很干净,如果我要从某项中注销,则必须再次授予权限才能重新登录.

I can login to my Google Accounts page and revoke access from there, but it's a bit of a faff, and it feels cleaner that if I want to signout from something that I would have to grant permission again to sign back in.

是否有一种扩展可以撤消其对用户帐户的访问权?我以为是这样,但是我在Google上碰壁.我发现的最好结果是"撤销令牌",但感觉就像在那儿一样应该是使用 chrome.identity

Is there a way of an extension revoking it's own access to a users account? I would presume so, but I am hitting a wall on Google. The best I found is this "Revoking a token", but it feels like there should be a way to do it with chrome.identity or chrome.permissions.

推荐答案

我知道,Chrome身份由登录到Chrome浏览器的Google帐户(而不是Google的网络会话)控制.Chrome应用程序标识与登录Chrome的Google帐户相关联.您可以在Chrome设置中更改当前登录的帐户,但我建议您创建新的Chrome配置文件

As I know, the chrome identity is controlled by the Google account signed into the Chrome browser, not the web session for Google. Chrome app identities are tied to the Google account signed into Chrome. You can change the current signed in account in Chrome settings, but I recommend you create a new Chrome profile instead.

这篇关于如何从扩展程序中撤消Google帐户访问权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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