c2corg / c2corg/v6_api

Set Access-Control-Allow-Origin header to * on 401 responses

Open
#730 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
26
Forks
28
Avg merge
4h
Merged PRs (30d)
9

Description

If a token is obsolete or corrupted, API answer 401 response (Not authorized).

But in this case, Access-Control-Allow-Origin header in response is not set.

This combinaison (401 + no ACAO header) is interpreted by browsers as an invalid CORS request, and thus, absolutly not response data is provided to client javascript, to prevent any invalid utilisation of CORS data.

To reproduce :

1. on client side, send a XMLTHttpRequest to API with a fake Authorization header
2. set a onreadystate callback on your request
3. Try to see the response content in javascript : impossible. However, the response exists in dev console

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.