Hey guys, I'm struggling to get chrome.identity.getAuthToken() working in my extension. Here's what I've done so far.
1. Created my Oauth2 app in the google developers API console.
2. Modified my manifest json to include the installed key value and the "oauth2": {"client_id": "blah", "scopes":["blah"]}. (I know my key/client_id are working because I plugged them into the chrome-apps-samples/identity app with success.)
3. Added a button which executes the following event on click:
$("#google_login_link").click(
function () {
console.log("Identity:", chrome.identity);
chrome.identity.getAuthToken({ 'interactive': false },function (token) {
alert("back token=" + token);
console.log("Identity:", chrome.identity);
});
});
All that happens on click is the alert fires with token=undefined. And the console looks like the attached image.
------------
If I change "interactive" to true, when I click the button I'm redirected to chrome://settings with the red/pink box that says my account sign in details are out of date. (See attached). If I sign in again, it goes right back to chrome://settings and after a few seconds, the red/pink box reappears (even though I KNOW I'm putting in the right login info. The same login info works fine elsewhere on google.)
Sooo... I'm confused as to what is going on.
First, why is token undefined in the first situation?
Second, what does the console log output mean?
Third, why am I being redirected to chrome://settings?
Fourth, why doesn't my login information work?
Any help would be greatly appreciated.