Created
June 24, 2012 05:06
-
-
Save knkumar/2981717 to your computer and use it in GitHub Desktop.
oauth2 not happening
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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