Google chrome extension Chrome扩展的Dropbox身份验证

Google chrome extension Chrome扩展的Dropbox身份验证,google-chrome-extension,dropbox-api,Google Chrome Extension,Dropbox Api,我为此做了很多研究,但找不到任何可以帮助我的东西。 所以我正在开发一个chrome扩展,并将drop box与之集成。我试图实现的是在单击扩展图标时进行身份验证 document.addEventListener('DOMContentLoaded', init); var init = function () { var client = new Dropbox.Client({ key: 'mykey' }); client.authDriver(new Dropbox.AuthDrive

我为此做了很多研究,但找不到任何可以帮助我的东西。 所以我正在开发一个chrome扩展,并将drop box与之集成。我试图实现的是在单击扩展图标时进行身份验证

document.addEventListener('DOMContentLoaded', init);
var init = function () { 
var client = new Dropbox.Client({
key: 'mykey'
});
client.authDriver(new Dropbox.AuthDriver.ChromeExtension({
receiverPath: '/views/chrome_oauth_receiver.html'
}));
if (client.isAuthenticated()) {
client.getAccountInfo(function (error, accountInfo) {
if (error) {
console.log(error);
return;
}
console.log(accountInfo.name);
});
} 
else {
client.authenticate(function (error, client) {
if (error) {
console.log(error);
return;
}
console.log(client);
});
}
}
因此,最终发生的事情是这样的——每次单击扩展图标,它都会被重定向到身份验证页面,在该页面中寻求用户权限,这会发生在扩展之外的一个新选项卡中。我的扩展窗口(或弹出窗口)现在已经关闭

理想情况下,我希望这种情况第一次发生。从下一次开始(除非用户选择退出),code-client.isAuthenticated()应该返回true。但它每次都返回false。 我们每次都需要创建一个新的客户端实例,对吗

如果在authenticate调用中使用interactive:false,则不会重定向到权限页,但client.isAuthenticated()仍然为false。
client.isAuthenticated()返回值的依据是什么?必须是localStorage中的某个内容。

这里有一些关于使用Dropbox.AuthDriver.ChromeExtension的说明:您遵循了这些说明了吗?这里正在跟踪这些说明