I am writing a chrome extension in which I am trying to use the chrome.identity API. But my Chrome doesn't recognize identity.
On the following code in developer tools, I get an error saying "Cannot read property getAuthToken of undefined:
chrome.identity.getAuthToken({ 'interactive': false }, function(token) {
I tried typing in the console. chrome.extension works but chrome.identity is undefined.
My manifest.json has "identity" in permissions. I am on latest Chrome v38. Is there anything else required to enable the identity API?
The reason I was not able to use identity was because I was trying to access it from a content script. I switched to a background script and it works now! Thanks Rob!
PS! You also need to have "permissions": ["identity"]
set in your manifest.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With