In my Chrome extension, I need the Facebook token to be available all the time. To get this, I check the token by opening a tab and then requesting the token from the hash:
chrome.tabs.onUpdated.addListener(function(tabid, tab) {
if (tab.url && tab.url.indexOf(redirect) === 0) {
var params = tab.url.match(
/access_token=([a-zA-Z0-9]+)&expires_in=([0-9]+)/
);
Here, the “redirect” is the Facebook URL.
To get this working, I need the “tabs” permission, which appears as “Access to your tabs and browsing activity”, which can be repulsive for some users.
So, is there a way to get a Facebook token inside an extension with as few permissions as possible and as smooth as possible?
source
share