【发布时间】:2018-08-27 09:26:12
【问题描述】:
尝试使用 node js rest API 调用从 Assembla 获取数据。 我不确定如何使用 Bearer 令牌进行身份验证并获取 JSON 输出。 有什么方法可以使用 HTTP 请求并按预期获取输出。 请帮忙。
【问题讨论】:
尝试使用 node js rest API 调用从 Assembla 获取数据。 我不确定如何使用 Bearer 令牌进行身份验证并获取 JSON 输出。 有什么方法可以使用 HTTP 请求并按预期获取输出。 请帮忙。
【问题讨论】:
Put your access token in the request to authenticate api and you will get the json data
request({
method: 'GET',
uri: 'https://api.assembla.com/v1/spaces',
auth: {
bearer: access_token
}
}, function (error, response, body) {
//this contains a json object
});
【讨论】: