gpt4 book ai didi

javascript - Chrome 扩展程序 identity.email 为空

转载 作者:行者123 更新时间:2023-12-03 21:16:00 34 4
gpt4 key购买 nike

我正在尝试通过 chrome identity api 获取用户的电子邮件和 ID。

我在做这个

  chrome.identity.getProfileUserInfo(function(userinfo){
console.log("userinfo",userinfo);
email=userinfo.email;
uniqueId=userinfo.id;
});

我已指定 identity 权限并在范围内添加了 https://www.googleapis.com/auth/userinfo.email

用户通过 chrome.identity.getAuthToken 登录,我有访问 token 。

console.log("userinfo",userinfo); 返回 userinfo 对象 {email: "", id: ""}

最佳答案

getProfileUserInfo文档说:

  • email: Empty if the user is not signed in or the identity.email manifest permission is not specified.
  • id: Empty if the user is not signed in or (in M41+) the identity.email manifest permission is not specified.

编辑 manifest.json 以包含两种权限:

"permissions": ["identity", "identity.email"]

关于javascript - Chrome 扩展程序 identity.email 为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48872747/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com