Envia la peticion siempre y cuando lo hago sin el header, una vez que pongo el header me sale error
getMark : function(){
var tokenId = 'tok ' + sesionesControl.get('token');
//tokenId me regresa el token registrado...
var config = {
headers : {
'Authorization': tokenId
}
};
$http.get('http://sitio.com/app/user',config)
.success(function(data){
console.log(data);
})
.error(function(data){
console.log(data);
});
}
XMLHttpRequest cannot load http://sitio.com/app/user. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. The response had HTTP status code 404.
OPTIONS /app/user HTTP/1.1
Host: sitio.com
Connection: keep-alive
Access-Control-Request-Method: GET
Origin: http://localhost
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36
Access-Control-Request-Headers: authorization
Accept: */*
Referer: http://localhost/Angular/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: es-ES,es;q=0.8,en;q=0.6
Gracias a los que respondan :)
P.D. Al enviar usando aplicaciones(extensiones de Chrome) como PostMan si reconoce