In Google Drive API, I am getting the error Method not allowed
This is the code I am using which throws the error:
xhr.open("POST", 'http://accounts.google.com/o/oauth2/token');
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
var data = {
code : code,
client_id : _opt.clientId,
client_secret : _opt.clientSecret,
redirect_uri : 'urn:ietf:wg:oauth:2.0:oob',
grant_type : 'authorization_code'
};
// Send the request.
xhr.send(data);
How do I solve this error?