Working on updating a Chrome plugin. I have users with multiple Gmail accounts opened on different browser tabs. The chrome plugin will create a button in each gmail tab, when user clicks on the button, the plugin needs to get the authToken for the gmail account before taking action. I was using the following
chrome.identity.getAuthToken({ interactive: true },
function(token) {..})
But the problem is, the authToken may not be the right one for the current gmail account (each browser tab has a different gmail account). I have seen it gets the authToken for the primary account and tried it on other gmail accounts, which will cause my action to fail.
Following what's described in identity API, I was thinking of using
chrome.identity.getAuthToken({ interactive: true, account: {id : "<ACCOUNT_ID>"} },
function(token) {..})
But I can't find the ACCOUNT_ID
. I tried the following API (from the same reference)
chrome.identity.getProfileUserInfo(function(x) {console.log(x) })
but it gave me
{email: "", id: ""}
Any ideas? Thanks a lot!