Skip to content

Instantly share code, notes, and snippets.

@knkumar
Created June 24, 2012 05:06
Show Gist options
  • Save knkumar/2981717 to your computer and use it in GitHub Desktop.
Save knkumar/2981717 to your computer and use it in GitHub Desktop.
oauth2 not happening
//in popup.js
var google = new OAuth2('google', {
client_id: '17755888930840',
client_secret: 'b4a5741bd3d6de6ac591c7b0e279c9f',
api_scope: 'https://www.googleapis.com/auth/tasks'
});
function authorize() {
google.authorize(checkAuthorized);
}
function checkAuthorized() {
console.log('checkAuthorized');
if (google.hasAccessToken()) {
// do nothing all is ok
} else {
authorize();
}
}
// in manifest.json
"content_scripts": [
{
"matches": ["http://*/*"],
"js" : ["js/oncopy.js"]
},
{
"matches": ["http://www.google.com/robots.txt*"],
"js": ["oauth2/oauth2_inject.js"],
"run_at": "document_start"
}
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment