1

我正在使用以下德尔福代码:

 clHttp1.Request.Header.ContentType := 'application/x-www-form-urlencoded';
 try
    AccountKey:=Account;
    clHttp1.Request.AddFormField('client_id',clientValue);
    clHttp1.Request.AddFormField('client_secret',AccountKey);
    clHttp1.Request.Header.Authorization:='Basic ' + Encode64(AccountKey + ':' + AccountKey);
    clHttp1.Post('https://api.datamarket.azure.com/Bing/MicrosoftTranslator/v1/Translate?Text=%27developer%27&To=%27es%27&From=%27en%27', value);
except
      on e: Exception do
        ShowMessage(e.Message);
end;

并且总是收到错误“不支持您提供的授权类型。仅支持基本和 oauth”并响应

HTTP/1.1 401 The authorization type you provided is not supported.  Only Basic and OAuth are supported
Server: Microsoft-IIS/8.0
X-Content-Type-Options: nosniff
WWW-Authenticate: Basic Realm=""
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: false
Access-Control-Allow-Headers: Authorization, DataServiceVersion, MaxDataServiceVersion
Access-Control-Expose-Headers: DataServiceVersion, MaxDataServiceVersion
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Max-Age: 604800
Date: Wed, 19 Nov 2014 09:40:24 GMT
Content-Length: 91

我做错了什么?

4

0 回答 0