Quantcast
Channel: Slack files: XMLHttpRequest cannot load response for preflight is invalid (redirect) - Stack Overflow en español
Viewing all articles
Browse latest Browse all 4

Slack files: XMLHttpRequest cannot load response for preflight is invalid (redirect)

$
0
0

Estoy usando angularjs@v1.3 para hacer un request a la api de slack. Según me dice Slack files types necesito agregar el Authentication en el header. Hago el request desde postman y me devuelve el archivo que necesito.

GET /files-pri/... HTTP/1.1Host: files.slack.comAuthorization: Bearer A_VALID_TOKENCache-Control: no-cachePostman-Token: POSTMAN_TOKEN

Ahora, haciendo esto desde angular me devuelve XMLHttpRequest cannot load. Response for preflight is invalid (redirect).

$http(  method: 'GET',  url: url_private_download,  headers: {    Authorization: 'Bearer '+ token  }});

No estoy seguro qué estoy haciendo mal y por qué me devuelve este error, he leído algunas preguntas similares de SO en inglés pero no me queda claro.

Actualización: Al final parece ser un problema con OPTIONS, según entiendo de esto, angular(o el navegador, no estoy seguro) solo evita el OPTIONS si Content-Type=text/plain. ahora, el problema es que solo lo puedo hacer sin el Authorization.

¿Cómo agrego el Authorization evitando el preflight?

Request actual, necesita el Auth:

$http(  method: 'GET',  url: url_private_download,  headers: {'Content-Type': 'text/plain',  }});

Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images