解析云代码修改变量

时间:2015-10-29 17:20:16

标签: javascript parse-platform

我正在将Microsoft Translator集成到Parse的Cloud Code中。我可以成功获取访问令牌 - 例如:

http%253a%252f%252fschemas.xmlsoap.org%252fws%252f2005%252f05%252fidentity%252fclaims%252fnameidentifier%3Dcapital-dev%26http%253a%252f%252fschemas.microsoft.com%252faccesscontrolservice%252f2010%252f07%252fclaims%252fidentityprovider%3Dhttps%253a%252f%252fdatamarket.accesscontrol.windows.net%252f%26Audience%3Dhttp%253a%252f%252fapi.microsofttranslator.com%26ExpiresOn%3D1446139162%26Issuer%3Dhttps%253a%252f%252fdatamarket.accesscontrol.windows.net%252f%26HMACSHA256%3DRXDUXmSV1C%252bJPhtDFfe0obgUQ2ZOW1XtlzL00lE934E%253d

(非常奇怪的是,顺便说一句,但在使用Postman进行调试时工作正常)

稍后,当我尝试向

发送翻译请求时
http://api.microsofttranslator.com/V2/Ajax.svc/Translate

使用与令牌相同的httpRequest:

Parse.Cloud.httpRequest({
    method: 'GET',
    url:    'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=Bearer ' + request.params.token + '&to=en&text=' + request.params.text,
    success: function(result) {
        response.success(result);
    },
    error: function(error) {
        response.error({
            token: request.params.token,
            error: error,
            url: 'http://api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=Bearer ' + request.params.token + '&to=en&text=' + request.params.text,
        });
    },
});

在错误回调中,我的令牌修改如下:

http%!a(MISSING)%!f(MISSING)%!f(MISSING)schemas.xmlsoap.org%!f(MISSING)ws%!f(MISSING)2005%!f(MISSING)05%!f(MISSING)identity%!f(MISSING)claims%!f(MISSING)nameidentifier%!D(MISSING)capital-dev%!h(MISSING)ttp%!a(MISSING)%!f(MISSING)%!f(MISSING)schemas.microsoft.com%!f(MISSING)accesscontrolservice%!f(MISSING)2010%!f(MISSING)07%!f(MISSING)claims%!f(MISSING)identityprovider%!D(MISSING)https%!a(MISSING)%!f(MISSING)%!f(MISSING)datamarket.accesscontrol.windows.net%!f(MISSING)%!A(MISSING)udience%!D(MISSING)http%!a(MISSING)%!f(MISSING)%!f(MISSING)api.microsofttranslator.com%!E(MISSING)xpiresOn%!D(MISSING)1446139162%!I(MISSING)ssuer%!D(MISSING)https%!a(MISSING)%!f(MISSING)%!f(MISSING)datamarket.accesscontrol.windows.net%!f(MISSING)%!H(MISSING)MACSHA256%!D(MISSING)RXDUXmSV1C%!b(MISSING)JPhtDFfe0obgUQ2ZOW1XtlzL00lE934E%!d(MISSING)

我被困在这里...... 有任何想法吗? 谢谢!

0 个答案:

没有答案