Implementing Google OAuth with jQuery, is this possible?

I am trying to fully implement client-side OAuth for the Google APIs using jQuery. I am using the oauth.js and sha1.js libraries.

url = "https://www.google.com/accounts/OAuthGetRequestToken";
var accessor = { consumerSecret: 'abc' };
var parameter = {
    oauth_consumer_key:'www.oauthorization.appspot.com',
    oauth_signature_method:'HMAC-SHA1',
    scope:'http://www.google.com/calendar/feeds/private/default/full',
    oauth_timestamp:010111,oauth_nonce:abc,
    oauth_signature:qbc,
    oauth_callback:'http://abc.appspot.com/'
}

OAuth.setTimestampAndNonce(message);
OAuth.SignatureMethod.sign(message, accessor);

$.ajax({
    url: url,
    type: "POST", 
    beforeSend: function( xhr ) {
        xhr.overrideMimeType( 'application/x-www-form-urlencoded' );
        xhr.setRequestHeader('Authorization', 'OAuth');
        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    },
    data: parameter
});

When starting the above AJAX call, I get a 405 error, an error is not allowed in firefox, and the Source null is not allowed by Access-Control-Allow-Origin. in chrome.

Help solve these errors or give me some working examples of jQuery OAuth implementation for Google.

+5
source share
1 answer

manifest.json.

"permissions": [
    "tabs",
    "https://www.google.com/"
  ],

: Chrome oAuth

0

All Articles