Javascript cloudinary身份验证引物
我正在尝试使用Cloudinary REST API,但提供的客户端库对我的目的没有用处 因此,我使用的设置是:Javascript cloudinary身份验证引物,javascript,cors,restful-authentication,cloudinary,Javascript,Cors,Restful Authentication,Cloudinary,我正在尝试使用Cloudinary REST API,但提供的客户端库对我的目的没有用处 因此,我使用的设置是: api_key = '111111111111111'; api_secret = 'fdgdsfgsdfgsdfgsdfgsdfg'; my_authorization = 'Basic ' + window.btoa(this.api_key + ':' + this.api_secret); url_base = 'http://api.cloudinary.com/api/v
api_key = '111111111111111';
api_secret = 'fdgdsfgsdfgsdfgsdfgsdfg';
my_authorization = 'Basic ' + window.btoa(this.api_key + ':' + this.api_secret);
url_base = 'http://api.cloudinary.com/api/v1_1';
cloud_name = '/http-mysite-com';
connect_method = 'GET';
tag_list = '/tags/image';
我用类似的方式打电话:
request(tag_list) {
connection.request({
method: connect_method,
url: url_base + cloud_name + service_url,
headers: {
'Authorization': authorization,
'Content-Type': 'application/json'
}
}).then(function(response) {
// triumph
}, function(er) {
// all is lost
});
};
答复如下:
无法加载XMLHttpRequest
. 不
“Access Control Allow Origin”标头出现在请求的服务器上
资源。来源<代码>'http://myhost:8000因此,不允许使用“”
通道响应的HTTP状态代码为404
我做错了什么
谢谢
PS我还尝试使用“https”而不是“http”作为文档。在这种情况下,我会回来:
无法加载XMLHttpRequest
. 这个
请求已重定向到
'',
这是不允许的跨来源请求,需要飞行前
管理员API调用使用您的
API_secret
,这不应该在客户端代码中显示。这就是为什么Cloudinary不支持管理员API的CORS头。
因此,管理API调用应该只在服务器端执行