Skip to content

Instantly share code, notes, and snippets.

@ilmsg
Created September 22, 2012 19:46
Show Gist options
  • Save ilmsg/3767573 to your computer and use it in GitHub Desktop.
Save ilmsg/3767573 to your computer and use it in GitHub Desktop.
chrome.tabs.onUpdated.addListener(function() {
var lis = this;
chrome.tabs.getAllInWindow(null, function(tabs) {
for (var i = 0; i < tabs.length; i++) {
if (tabs[i].url.indexOf("http://localhost:7002/auth") == 0) {
var token = tabs[i].url.match(/[\\?&#]access_token=([^&#])*/i);
TLab.setAccessToken(token);
alert('token : '+TLab.getAccessToken());
chrome.tabs.onUpdated.removeListener(lis);
return;
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment