我正在使用下面的函数通过JS SDK测试API调用。我在控制台日志中得到的结果如下所示。你可以检查我的代码,让我知道这里有什么问题吗?
此接口返回的响应为:[object Object]
此接口返回的JSON响应为:[object Object]
app.get('/log', function(req, res) {
var authData = rcsdk.platform().auth().data();
rcsdk.platform().auth().setData(authData);
token_json = authData['access_token'] ?
JSON.stringify(authData.access_token, null, ' ') : '';
response = token_json;
console.log("Before the/account/~/extension/~/presence");
rcsdk.platform().get('/account/~/extension/~/call-
log').then(function(apiResponse){
// If you want the response object
console.log("The response returned by this API is : " +
apiResponse.response());
// If you want the response object as JSON
console.log("The response JSON returned by this API is : " +
apiResponse.json());
});
console.log("Outside the API Request");
res.render('index', {
authorize_uri: rcsdk.platform().authUrl({
brandId: process.env.RC_APP_BRAND_ID, // optional
redirectUri: process.env.RC_APP_REDIRECT_URL // optional if 1
configured
}),
redirect_uri: process.env.RC_APP_REDIRECT_URL,
token_json: token_json,
dibyendu_roy: response
});
// Render home page with params
});
发布于 2017-12-15 23:44:02
我不知道你想在这里实现什么。为什么从rcsdk.platform
获取authData
,然后用setData()
重新设置它
SDK在哪里实例化?
https://stackoverflow.com/questions/47824745
复制相似问题