Yeah, I was trying to make him work for it a bit.
Trying to help people come up with more imaginative solutions, since MV2 really enables a lot of creativity beyond just
"here's some API call".
There's actually several different ways to skin this cat.
The simplest, though, for grabbing what you're asking for, is just:
async function gimmeDatUserEmailPlz() {
return new Promise(resolve => {
chrome.identity.getProfileUserInfo({ accountStatus: "ANY" }, userInfo => resolve(userInfo.email));
});
}
You need to have the following permissions in the manifest:
"identity"
"identity.email"
The latter of those too is poorly (if at all) documented.
Poor/incomplete documentation is a big part of why being a browser extension developer means high job security. 😉