title: How to use onSignInChanged event handler in chrome extension for gmail?
body: <p>Here is the code of my google chrome extension</p>
  
  <p>Manifest:</p>
  
  <pre><code>"content_scripts": [
    {
     "matches": [
     "https://mail.google.com/*",
     "https://inbox.google.com/*"
   ],
   "js": ["js/jquery-3.2.1.min.js", "js/content.js"],
   "css": ["css/custom.css"],
   "run_at": "document_end"
   }
  ],
  "background":{
    "scripts": ["js/background.js"],
    "persistent": true
  },
  "permissions": [
    "https://mail.google.com/",
    "https://inbox.google.com/",
    "https://accounts.google.com/*",
    "identity",
    "identity.email",
    "storage"
  ],
  "oauth2":{
    "client_id": "xxx",
    "scopes": [
      "profile",
      "https://www.googleapis.com/auth/gmail.readonly",
      "https://www.googleapis.com/auth/contacts.readonly",
      "https://www.googleapis.com/auth/plus.login",
      "https://www.googleapis.com/auth/userinfo.profile",
       "https://www.googleapis.com/auth/userinfo.email"
    ]
  }
  </code></pre>
  
  <p><code>background.js</code></p>
  
  <pre><code>//get google OAuth Token
  chrome.identity.getAuthToken({
    interactive: true
  }, function(token) {
    if (chrome.runtime.lastError) {
      console.log(chrome.runtime.lastError.message);
      alert(chrome.runtime.lastError.message);
      return;
    }
    console.log(token);
    currentSessionAccessToken = token;
    var x = new XMLHttpRequest();
    x.open('GET',
      'https://www.googleapis.com/oauth2/v2/userinfo?alt=json&amp;access_token=' + token
    );
    x.onload = function() {
      console.log(x.response);
    };
    x.send();
  });
  
  //registered event handler for signIn change
  chrome.identity.onSignInChanged.addListener(function(accountInfo, isSignedIn){
    console.log(accountInfo);
  });
  </code></pre>
  
  <p>But, <strong>onSignInChanged</strong> event is not fired when I switch to another user. Actually, I want to revoke the token generated for previously logged in user when signIn is changed and generate a new token for newly logged in user.</p>
  
  <p>Since, the event is not fired, my extension is loading contacts of previously logged in user. I have followed Google's <a href="https://developer.chrome.com/extensions/identity#event-onSignInChanged" rel="nofollow noreferrer">this</a> documentation. No idea why the event is not getting fired. Am i missing anything?</p>