OPTIONS
https://imgur-apiv3.p.mashape.com/3/image 401 (Unauthorized)
Access to XMLHttpRequest at ‘https://imgur-apiv3.p.mashape.com/3/image’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
var imgurToken = "";
var clientId = '’; //private
//var MashapeKey = ‘’; //testing key
var MashapeKey = '’; //production key
function imgurUpload(token, tel) {
//group.hide();
var auth;
if (token) auth = 'Bearer ’ + token;
else auth = 'Client-ID ’ + clientId;
//auth = 'Client-ID ’ + clientId;
$.ajax({
// url: ‘https://api.imgur.com/3/image’,
url: ‘https://imgur-apiv3.p.mashape.com/3/image’,
type: 'POST',
headers: {
'X-Mashape-Key': MashapeKey,
Authorization: auth,
Accept: 'application/json'
},
data: {
image: base64ImgResult,
type: 'base64'
},
success: function(result) {
var id = result.data.id;
//window.location = 'https://imgur.com/gallery/' + id;
//imgHostUrl = 'https://i.imgur.com/' + id + ".jpg";
imgHostUrl = 'https://imgur.com/' + id;
//window.location = 'https://i.imgur.com/' + id + ".jpg";
smsSend(imgHostUrl, tel);
imgurLog ("sent", id);
},
error: function(jqXHR, status, err) {
console.log(formatErrorMessage(jqXHR, status));
imgurLog ("fail", formatErrorMessage(jqXHR, status));
smsLog ("fail - imgurUp", "none", tel);
// console.log (jqXHR);
//smsSend();
}
});
}
Join in the discussion - add comment below: