Reputation: 137
I'm trying to get a Chrome extension that interacts with Dropbox's API, using OAuth2. I have read the Identity API documentation but I am confused on where to invoke chrome.identity.launchWebAuthFlow()
.
I have created a background page, and included a .js script which calls chrome.identity.launchWebAuthFlow()
, but I get undefined
when I call console.log(chrome.identity)
. console.log(chrome)
prints an object to console.
Am I misunderstanding something? Do I have to use a listener and invoke that function after something happens?
Upvotes: 1
Views: 1297
Reputation: 77571
In general, if chrome.something
is undefined while it should exist, you don't have permissions to use it. Either you need a permission in your manifest, or it cannot be used in the current context (i.e. a content script).
In your case, you must be missing "identity"
permission in the manifest. It's specified in the documentation header.
Upvotes: 3