Getting the correct Google client ID for Chrome users with multiple accounts

I’m trying to get the Google Client Id (found under of a user corresponding to the account he’s currently connected with.

Explanation: when connecting with your gmail account on Chrome, the result of the code given here ( gives the user’s client ID that I need to use the Google Payment API.
The problem is if the user has multiple accounts connected on Chrome.

Example: Our user has an email account for work (WEmail) and a personal email account (PEmail). He first connects to chrome using his WEmail. Then adds his PEmail to the list of Chrome connected accounts. Then our user wishes to make a payment on an extension he has installed, with his PEmail.

The issue here is that to process such a payment you need the google client ID of that user, and when you fetch it, you will get the one of the first connected account (WEmail) and not the one of the current used account (PEmail). Which makes it impossible to process the payment since you might not be serving the right account.

Is there any way to get all the currently used ids of a user or jsut the currently used id?
If not, are there plans to integrate such a solution in the short term?

Thanks for your help. not storing values (inside background.js page in chrome extension)

The following is code from a chrome extension I’m working on. My manifest.json has the appropriate “storage” permission. The output I refer to in the code block is being seen in the ‘inspect popup’ javascript console, for background pages. I even tried downloading the storage explorer and checking there, and it shows the being empty after the function finishes. Any thoughts? I’ve been at this bug for days.

(It seems all the similar API questions on stackoverflow have to do with not understanding the asynchronous nature of the API, but that isn’t the case here obviously, so I’m stuck.)

function startOauth() {
  // open stripe onboarding
    'url': '',
    'interactive': true
  }, (redirect_url) => {
    // check if user exited or finished onboarding
    if(!chrome.runtime.lastError) {
      let code = redirect_url.substring(redirect_url.lastIndexOf('=')+1);
      // no error, so send code to backend to retrieve userid and authtoken for user
      $.post('', { code }, (data) => {
        if(data.error) {
          // problem retrieving authtoken from stripe
          console.log(data.error, data.error_description);
        } else {

          // authtoken and account data for user retrieved. store for later
          console.log('response: ', data); // <---- THIS PRINTS FULL DATA OBJECT
            "key1": data.value1,
            "key2": data.value2,
            "key3": data.value3,
          }, () => {
            // check and see if stored successfully
  , (items) => {
              console.log('storage: ', items); // <---- THIS PRINTS {}

      }).fail(() => {
        console.log('POST request to backend failed');
    } else {
      console.log('user quit the oauth process');

What algorithm do Google use to fetch frequently contacted users in Google Contacts?

I do not see any way to get Frequently Contacted users in Google Contact API documentation. However, there is a section named ‘Frequently Contacted’ in Google Contacts page. I want to retrieve these contacts in my chrome app. How can i achieve this with minimal request to the Google APIs?