I am trying to connect the Bing translator to my EXT JS. I'm having trouble trying to get the access token. No matter what I've tried I get 400 bad request.
This is my code:
var clientId = encodeURI("<my id>"),
clientSecret = encodeURI("<my secret>"),
scope = encodeURI("http://api.microsofttranslator.com"),
grantType = encodeURI("client_credentials");
var params = {client_id : clientId,
client_secret : clientSecret,
scope : scope,
grant_type : grantType};
Ext.Ajax.request({
url : "https://datamarket.accesscontrol.windows.net/v2/OAuth2-13/",
method : "POST",
params : params,
success : function(response) {
alert("Success");
},
fail : function() {
alert("Fail");
}
});
I am beginning to think it is not possible. I believe this is making a request which https://datamarket.accesscontrol.windows.net/v2/OAuth2-13/ doesn't allow. Maybe it is doing this client side? Or maybe the https url doesn't work in Ajax.request. Any help at all appreciated.