I am developing a self hosted chrome extension and have generated the key and client_id as described here. My call to getAuthToken is (copied from the answer to this question)
chrome.identity.getAuthToken({
interactive: true
}, function(token) {
if (chrome.runtime.lastError) {
alert(chrome.runtime.lastError.message);
return;
}
var x = new XMLHttpRequest();
x.open('GET', 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=' + token);
x.onload = function() {
alert(x.response);
};
x.send();
});
However I find that while the user is correctly directed to the google login page, my call back is never called after the user is correctly authenticated. My question: Is it the case that I have to register my application with Google (rather than use a self-generated key pair, key and client_id) for my callback to be called? For a test application registered with google, the same callback is correctly called.
My manifest file has
"permissions": [
"background",
...
"identity",
"*://*/*"
],
"key" : "Long key here",
"oauth2" : {
"client_id" : "Id of length 32",
"scopes" : [
"https://www.googleapis.com/auth/plus.login"
]
}
Thank you.