KartikTalwar / gmail.js

Gmail JavaScript API
MIT License
3.76k stars 457 forks source link

gmail.get.loggedin_accounts() always returns a blank list #676

Closed peterhartree closed 2 years ago

peterhartree commented 2 years ago

api.get.loggedin_accounts() relies on the Gmail GLOBALS object.

Unfortunately that object no longer contains a list of logged in user accounts.

You can see this by opening the console at mail.google.com and typing GLOBALS. Gmail.js is expecting account information at GLOBALS[17], but it's just a blank array.

For now, my guess is that there's no longer a good way to get a list of logged in user accounts, so this feature should be removed from Gmail.js.

Thank you for your work on this project.

Possible fixes

I've looked around the DOM a bit for ways to fix this and come up short.

For a while it was possible to read the logged in account information by using CSS selectors to get the information from the Google account switcher menu in the top right corner. However, the account switcher has now been moved into an <iframe> on a different domain, so it is no longer possible to access those elements.

josteink commented 2 years ago

Hey there and thanks for reporting!

If it doesn't work and it can't be fixed, I agree we should remove it to avoid people getting wrong expectations.

Cleaning it up would involve roughly these things:

PRs welcome? ;)

josteink commented 2 years ago

Looking into the code, with this function being broken, so does api.get.delegated_to_email() appear as well.

josteink commented 2 years ago

That in effect also breaks/obsoletes api.get.manager_email(), since that will now always return api.get.user_email().

Seems like we have a release coming with quite a few breaking changes.

Sounds like a good chance to clean out other cruft as well :smile:

josteink commented 2 years ago

Working on removing these now in the vnext-branch.

Feedback welcome.

josteink commented 2 years ago

Updated on npmjs in version 1.0.23.