在我的chrome扩展程序中,我正在按以下方式访问身份验证令牌。
chrome.tabs.query({'active': true, 'currentWindow': true}, (tabs) => {
chrome.identity.getAuthToken({'interactive': false}, (response) => {
if (!response) {
chrome.identity.getAuthToken({'interactive': true}, (response) => {
//perform action after getting response token from interactive window which is not working
});
} else {
// action
});
});
如果我在缓存中有令牌,我会做出回应,但是当我没有令牌时,我会看到一个提示窗口,用于授予访问权限:“选择一个帐户继续..”
此弹出窗口仅对少数用户/机器打开。后台js中记录的错误是 *
“未经检查的runtime.lastError:未授予或撤销OAuth2。”
*
我们如何显式打开授权访问窗口?