Uncaught TypeError: Cannot read property 'getAuthToken' of undefined?
See original GitHub issuechrome.identity.getAuthToken({ 'interactive': true },
function(token) {
if (chrome.runtime.lastError) {
alert(JSON.stringify(chrome.runtime.lastError));
} else {
alert(token);
}
});
Here, i am getting the error in first line.
and this the manifest of permission:
"permissions": ["identity", "https://www.googleapis.com/", "https://accounts.google.com/", "https://*.googleusercontent.com/","https://*.chromiumapp.org/*", "https://accounts.google.com/o/oauth2/v2/auth"],
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Chrome.identity not available/undefined - Stack Overflow
But my Chrome doesn't recognize identity. On the following code in developer tools, I get an error saying "Cannot read property getAuthToken of...
Read more >chrome.identity.getAuthToken is undefined - Google Groups
Yet whenever I try to invoke the getAuthToken method, I get a TypeError stating that it cannot read the property getAuthToken.
Read more >chrome.identity - Chrome Developers
Gets an OAuth2 access token using the client ID and scopes specified in the oauth2 section of manifest.json. The Identity API caches access...
Read more >A brand new website interface for an even better experience!
Uncaught TypeError : Cannot read property 'getAuthToken' of undefined?
Read more >Google-chrome – Chrome.identity not available/undefined
But my Chrome doesn't recognize identity. On the following code in developer tools, I get an error saying "Cannot read property getAuthToken of...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jliukai
you have to do it from a background script otherwise it will not work and it will give you chrome identity as undefined.
https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples/identity
here in the example in the manifest you have background script defined as main.js this script uses index.html to load the identity script and so it’s working as a backround script. Just check the background scripts docs and how to exchange events between content and background and you will be good.
it may?