I am trying to get email and id of user through chrome identity api.
I am doing this
chrome.identity.getProfileUserInfo(function(userinfo){
console.log("userinfo",userinfo);
email=userinfo.email;
uniqueId=userinfo.id;
});
I have specified identity
permission and have added https://www.googleapis.com/auth/userinfo.email
in scopes.
User is logged in through chrome.identity.getAuthToken
and I have access token.
console.log("userinfo",userinfo);
returns userinfo Object {email: "", id: ""}
In addition to having the identity.email
permission, as posted in the related Chrome issue for this subject, users must have their profile syncing turned on under chrome://settings
-> People -> Sync for their ID and email to show up using chrome.identity.getProfileUserInfo
.
The getProfileUserInfo documentation says:
- 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.
Edit manifest.json
to include both permissions:
"permissions": ["identity", "identity.email"]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With