Chrome扩展程序身份.电子邮件为空 [英] Chrome extension identity.email empty
本文介绍了Chrome扩展程序身份.电子邮件为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试通过Chrome身份api获取用户的电子邮件和ID.
I am trying to get email and id of user through chrome identity api.
我正在这样做
chrome.identity.getProfileUserInfo(function(userinfo){
console.log("userinfo",userinfo);
email=userinfo.email;
uniqueId=userinfo.id;
});
我已指定identity
权限,并在范围内添加了https://www.googleapis.com/auth/userinfo.email
.
I have specified identity
permission and have added https://www.googleapis.com/auth/userinfo.email
in scopes.
用户通过chrome.identity.getAuthToken
登录,并且我具有访问令牌.
User is logged in through chrome.identity.getAuthToken
and I have access token.
console.log("userinfo",userinfo);
返回userinfo Object {email: "", id: ""}
推荐答案
getProfileUserInfo 文档说:
- 电子邮件:如果用户未登录或未指定identity.email清单权限,则为空.
- id :如果用户未登录或未指定身份(电子邮件清单)权限,则为空.
- 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
以同时包含两个权限:
Edit manifest.json
to include both permissions:
"permissions": ["identity", "identity.email"]
这篇关于Chrome扩展程序身份.电子邮件为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文