i am folowing this guide and trying to get a accses token from google api. i alredy got an auth code. so i'm using angularjs to send httprequest to google server. the problem is that i always get bad request answer. this is my code:
$http({
method: 'POST',
url: 'https://accounts.google.com/o/oauth2/token',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
params : {
code : '4/heMv6ozWwCxS5RyTzCgThAgxvRyk.oske-bNEGOUTOl05ti8ZT3YnwwH8iQI',
client_id : GoogleAppInfo.clientId,
redirect_uri : GoogleAppInfo.redirect_uri,
client_secret : GoogleAppInfo.client_secret,
grant_type : 'authorization_code'
},
data :'Demo' //just data to apply the heaser
}).
success(function(data, status, headers, config) {
alert('secsses');
}).
error(function(data, status, headers, config) {
alert('error');
});
i have used PostMan chorme addon to test my params, and it's working on postman.
The error down there is because the authcode for this request has expired, But it st working!

does anybody have a sulotion to this problem? thanks a lot!!