Eventbrite API 无法使用 nodejs 创建事件,收到错误 403 not_authorized 响应
Eventbrite API unable to create event using nodejs, getting error 403 not_authorized response
我正在尝试使用 API 创建 Eventbrite 事件,这是我的代码
var request = require('request');
var EVENTBRITE_API_URL = 'https://www.eventbriteapi.com/v3/';
var _token = '<TOKEN>';
var _event = {
"event.name.html": "TestEvent01",
"event.description.html": "TestEvent01",
"event.start.timezone": "America/Chicago",
"event.start.utc": "2018-02-10T18:00:00Z",
"event.end.timezone": "America/Chicago",
"event.end.utc": "2018-02-10T20:00:00Z",
"event.currency": "USD",
};
var request = require('request');
var _headers = {
'Authorization': 'Bearer ' + _token,
'Content-Type': 'application/x-www-form-urlencoded',
}
// Configure the request
var options = {
url: EVENTBRITE_API_URL + "events/",
method: 'POST',
headers: _headers,
form: _event,
};
request(options, function (error, response, body) {
if (!error) {
console.log(body);
}
});
它不起作用,我收到以下响应:
{"status_code": 403, "error_description": "You do not have permission to access the resource you requested.", "error": "NOT_AUTHORIZED"}
谁能说明这里出了什么问题。提前致谢!
我不是节点专家,但这对我来说还不错。我猜你没有传递正确的令牌。您可以创建一个令牌 here。您应该在授权中传递的令牌字符串 header 标记为 您的个人 OAuth 令牌。
干杯!
我正在尝试使用 API 创建 Eventbrite 事件,这是我的代码
var request = require('request');
var EVENTBRITE_API_URL = 'https://www.eventbriteapi.com/v3/';
var _token = '<TOKEN>';
var _event = {
"event.name.html": "TestEvent01",
"event.description.html": "TestEvent01",
"event.start.timezone": "America/Chicago",
"event.start.utc": "2018-02-10T18:00:00Z",
"event.end.timezone": "America/Chicago",
"event.end.utc": "2018-02-10T20:00:00Z",
"event.currency": "USD",
};
var request = require('request');
var _headers = {
'Authorization': 'Bearer ' + _token,
'Content-Type': 'application/x-www-form-urlencoded',
}
// Configure the request
var options = {
url: EVENTBRITE_API_URL + "events/",
method: 'POST',
headers: _headers,
form: _event,
};
request(options, function (error, response, body) {
if (!error) {
console.log(body);
}
});
它不起作用,我收到以下响应:
{"status_code": 403, "error_description": "You do not have permission to access the resource you requested.", "error": "NOT_AUTHORIZED"}
谁能说明这里出了什么问题。提前致谢!
我不是节点专家,但这对我来说还不错。我猜你没有传递正确的令牌。您可以创建一个令牌 here。您应该在授权中传递的令牌字符串 header 标记为 您的个人 OAuth 令牌。
干杯!