weixin_33713503 2015-03-24 23:51 采纳率: 0%
浏览 61

AngularJS CORS Web API调用

I am trying to make a request to the Eventbrite API. I can successfully make a call from Postman (chrome extension similar to fiddler)

url: https://www.eventbriteapi.com/v3/users/me/owned_events

Header: authentication : Bearer Y5R3SQRPRZBULIHYQHTD

This successfully gets back what I'm looking for. When I try to make the same call through AngularJS

function getLiveEvents() {
    return $http.get(url, {
        cache: true,
        headers: {
            'Authorization': 'Bearer Y5R3SQRPRZBULIHYQHTD',
            'Content-Type': 'application/x-www-form-urlencoded',
            'Accept': '*/*',
        }
    }).then(function (response) {
        return response.data;
    });
}

I always get the error XMLHttpRequest cannot load https://www.eventbriteapi.com/v3/users/me/owned_events?status=live. The request was redirected to 'https://www.eventbriteapi.com/v3/users/me/owned_events/?status=live', which is disallowed for cross-origin requests that require preflight.

Is there something I can do with my AngularJS request so that it will be successful?

FYI: The access-token is real, I'm not concerned about someone using it because it's just a test account.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 pycharm运行main文件,显示没有conda环境
    • ¥15 易优eyoucms关于二级栏目调用的问题
    • ¥15 寻找公式识别开发,自动识别整页文档、图像公式的软件
    • ¥15 为什么eclipse不能再下载了?
    • ¥15 编辑cmake lists 明明写了project项目名,但是还是报错怎么回事
    • ¥15 关于#计算机视觉#的问题:求一份高质量桥梁多病害数据集
    • ¥15 特定网页无法访问,已排除网页问题
    • ¥50 如何将脑的图像投影到颅骨上
    • ¥15 提问一个关于vscode相关的环境配置问题,就是输入中文但是显示不出来,代码在idea可以显示中文,但在vscode不行,不知道怎么配置环境
    • ¥15 netcore使用PuppeteerSharp截图