所以我想在我的Flex Mobile应用程序中集成PayPal。我第一次打电话是这样的:
(键是paypal dev资源的沙箱)
protected function getPaypal():void {
var client_id:String="EOJ2S-Z6OoN_le_KS1d75wsZ6y0SFdVsY9183IvxFyZp";
var secret:String="EClusMEUk8e9ihI7ZdVLF5cZ6y0SFdVsY9183IvxFyZp";
var params:Object = new Object();
params.grant_type="client_credentials";
var encoder:Base64Encoder = new Base64Encoder();
encoder.encode(client_id + ":" + secret);
//var s:String = JSON.stringify(params);
paypal.contentType = "application/x-www-form-urlencoded";
paypal.headers["Authorization"] = "Basic " + encoder.toString();
paypal.method = "POST";
paypal.url = "https://api.sandbox.paypal.com/v1/oauth2/token";
paypal.send(params);
}
此操作失败并返回以下内容:
'Error #2096: The HTTP request header Basic RU9KMlMtWjZPb05fbGVfS1MxZDc1d3NaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA6RUNsdXNNRVVrOGU5
aWhJN1pkVkxGNWNaNnkwU0ZkVnNZOTE4M0l2eEZ5WnA= cannot be set via ActionScript.' faultDetail:'null'
我无法弄清楚似乎是什么问题。
任何帮助?
答案 0 :(得分:2)
也许这个? https://stackoverflow.com/a/539173/3384609
要点:
您可以通过设置(在上面的示例中)来解决此问题 encoder.insertNewLines = false;默认设置为true。