0

我正在使用下面的函数来测试使用 JS SDK 的 API 调用。我在控制台日志中得到的内容如下。您能否检查我的代码并让我知道这里有什么问题。

此 API 返回的响应为:[object Object]

此 API 返回的响应 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

    });
4

1 回答 1

0

我不知道你想在这里实现什么。为什么你authData从那里得到rcsdk.platform然后把它放回去setData()

你在哪里实例化 SDK?

于 2017-12-15T15:44:02.483 回答