2016-01-21 115 views
1

我正在解析与paypal API完全兼容的云代码。今天,在做一些修改时,我注意到Parse Cloud代码在尝试通过Parse.Cloud.httpRequest访问Paypal分期API时抛出SSL错误。相同的代码在Paypal Production API没有任何问题的情况下工作。Parse.Cloud.httpRequest返回“请求失败; 35-111 SSL连接错误;连接被拒绝”

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'); 
    }); 
} 

任何帮助将不胜感激。

+0

我目前对paypal express使用沙箱,今天我有这个错误:'请求被中止:无法创建SSL/TLS安全通道。' –

+0

嗨有没有更新?我犯了同样的错误 – DaNLtR

回答

1

PayPal更新了其沙箱环境,只允许TLS 1.2连接,以提高安全性并为未来PCI合规做好准备。您可以在PayPal 2016 Merchant Security Roadmap Microsite上找到有关更新的更多信息。

在这种情况下,您需要询问Parse以确定其环境是否可以支持仅TLS 1.2连接。快速搜索Parse Google Group建议他们可能不支持仅TLS 1.2连接。

最近几天沙箱已经改变,现场生产现场计划在今年晚些时候。请检查官方日期的微型网站。

相关问题