Friday 15 August 2014

Google Chrome Extension with OAuth -


I am trying to integrate OAuth with my Chrome extension. I am following the tutorial by google:

I have background J to make XOTH (defined by me and it is filled with background.html).

  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_sect ':' anonymous ',' radius ':' https : //docs.google.com/feeds/ ',' app_name ': Test app'}); Oauth.authorize (onAuthorized);   

There is an unauthorized method here:

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

Am I missing something here? When I load the extension, it opens several "Redirecting ...." tabs Multiple Oops tab < / P>

A file is missing in the tutorial. If you open chrome_ex_oauth.html , you will see that it tries to load the 3 JS file:

  & Lt; Script type = "text / javascript" src = "chrome_ex_oauthsimple.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "chrome_ex_oauth.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "onload.js" & gt; & Lt; / Script & gt;   

onload.js file is not provided. Provides a file with the following content:

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

After adding this file, it works fine.

No comments:

Post a Comment