【发布时间】:2016-01-21 13:22:43
【问题描述】:
我正在解析与 paypal API 完全配合使用的云代码。今天在进行一些修改时,我注意到 Parse Cloud 代码在尝试通过 Parse.Cloud.httpRequest 访问 Paypal staging API 时抛出 SSL 错误。相同的代码在 Paypal Production API 上运行没有任何问题。
exports.get_refresh_token = function(authorization_code)
{
var Buffer = require('buffer').Buffer;
var buf = new Buffer(PAYPAL_CLIENT_ID + ':' + PAYPAL_SECRET, 'utf8');
var basicAuthString = "Basic " + buf.toString('base64');
return Parse.Cloud.httpRequest({
method:"POST",
url: API_SERVER + "/v1/oauth2/token",
headers: {
"Authorization":basicAuthString,
"Content-Type": "application/x-www-form-urlencoded",
"Accept-Language": "en_US"
},
body: 'grant_type=authorization_code&response_type=token&redirect_uri=urn:ietf:wg:oauth:2.0:oob&code=' + authorization_code
}).then(function(httpResponse) {
var res = JSON.parse(httpResponse.text);
console.log('response: ' + httpResponse + ' res: ' + res + ' at ' + res.access_token + ' rt ' + res.refresh_token);
return Parse.Promise.as(res);
},
function(httpResponse) {
console.error("Request failed " + httpResponse.text + ' : ' + authorization_code + ' ' + API_SERVER);
return Parse.Promise.error('Unable to get refresh token');
});
}
任何帮助将不胜感激。
【问题讨论】:
-
我目前使用沙箱进行贝宝快递,今天我遇到了这个错误:
The request was aborted: Could not create SSL/TLS secure channel. -
您好,有更新吗?我得到同样的错误
标签: ssl parse-platform paypal