作为我正在构建的 Google Chrome 扩展程序的一部分,我需要能够在扩展程序启用时判断用户是否已登录 Google Chrome 浏览器。
我怎样才能做到这一点?
请注意,使用 OAuth2(因此,the chrome.identity API https://developer.chrome.com/extensions/identity)超出了我的项目范围,所以我需要寻找另一种方法。
编辑:我的问题与此不重复one https://stackoverflow.com/questions/2971491/detecting-whether-user-is-logged-in-or-not-from-a-chrome-extension因为该线程中的解决方案不再有效。
检查是否 is set:
chrome.cookies.get({url:'https://accounts.google.com', name:'LSID'}, function(cookie) {
if (cookie) {
console.log('Sign-in cookie:', cookie);
}
});
manifest.json 权限:"cookies", "https://accounts.google.com/"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)