I'm able to get request token verifier from the library(http://oauth.googlecode.com/svn/code/javascript/), But got stuck in getting the access token.. can someone tell me where i'm doing it wrong?
function goForAccessRequest1(verifier){
var url2 = "http://www.google.com/accounts/OAuthGetAccessToken";
var accessor2 = {
token: OAuthToken,
//tokenSecret: OAuthTokenSecret,
signatureMethod : "HMAC-SHA1",
consumerKey : "1010722015153-i8tisqmaqch26b0muqvefbfp3h18m862.apps.googleusercontent.com",
//consumerSecret: "zZp8BsyfIzHJox1rBi8Lq3fm",
};
var message2 = {
action: url2,
method: "POST",
parameters: {
oauth_verifier : verifier,
//scope : "http://www.google.com/calendar/feeds",
}
};
OAuth.completeRequest(message2, accessor2);
var requestBody = OAuth.formEncode(message2.parameters);
//url2 = url2 + '?' + OAuth.formEncode(message2.parameters);
var AccessTokenRequest = new XMLHttpRequest();
AccessTokenRequest.open("POST", url2, true);
AccessTokenRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
AccessTokenRequest.setRequestHeader("Authorization", "OAuth");
AccessTokenRequest.send(requestBody);
AccessTokenRequest.onreadystatechange = function receiveAccessToken(){
if(AccessTokenRequest.readyState == 4){
console.log(AccessTokenRequest.responseText)
}
}
}
I'm getting the error like signature error whenever i try to send the parameters using "GET", and whenevr i send the parameters in POST body, getting the error as "parameters missing"