Extend Google Chrome with OAuth

I am trying to integrate OAuth with my chrome extension. I follow the google guide: https://developer.chrome.com/extensions/tut_oauth.html

I create ExOauth from background.js (determined by me and background.html loaded).

var oauth = ChromeExOAuth.initBackgroundPage({ 'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken', 'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken', 'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken', 'consumer_key': 'anonymous', 'consumer_secret': 'anonymous', 'scope': 'https://docs.google.com/feeds/', 'app_name': Test app' }); oauth.authorize(onAuthorized); 

Here is the OnAuthorized method:

 onAuthorized = function () { // Start my application logic. }; 

Am I missing something? When I download the extension, it opens several tabs "Redirecting ....". Multiple Oauth tabs

+7
source share
2 answers

The tutorial seems to be missing a single file. If you open chrome_ex_oauth.html , you will see that it is trying to download 3 js files:

 <script type="text/javascript" src="chrome_ex_oauthsimple.js"></script> <script type="text/javascript" src="chrome_ex_oauth.js"></script> <script type="text/javascript" src="onload.js"></script> 

The onload.js file onload.js not provided. OAuth Contacts Example provides such a file with the following contents:

 window.onload = function() { ChromeExOAuth.initCallbackPage(); } 

After adding this file, it works fine.

+4
source

I know the question is a little older, but I had the same problem.

I made a mistake to authenticate the two oauth endpoints and call ChromeExOAuth.initBackgroundPage ({}) both times. Obviously, this is the wrong reason why I don't want to run my background page twice.

Perhaps using ..._ oauthsimple.js will establish that

0
source

All Articles