Git Product home page Git Product logo

Comments (3)

corydolphin avatar corydolphin commented on August 16, 2024

Hey!

Thanks for writing in! There is an option just for that! Set
supports_credentials either as a kwarg, or else an app config.

It looks like the documentation build is currently messed up, and it is
difficult to find these options. I'm currently away for the weekend, and
will look into fixing his when I return.
On Fri, Oct 16, 2015 at 7:32 AM kk [email protected] wrote:

Here is my case:

Client post username and password to server, after authentication,
Server send header "Authorization" with auth token to client, then client
save the token.
Client and server is not in the same domain, so I need CORS.

server code:

from flask.ext.cors import CORS
CORS(app)

But it cause 'Refused to get unsafe header "Authorization"'

// xhr is response object
xhr = XMLHttpRequest {}, key = "Authorization"
xhr.getResponseHeader(key); // error

Then I set:

req.withCredentials=true

Then error:

XMLHttpRequest cannot load http://www.xxxx.cn/api/user/login. Credentials flag is 'true',        but the 'Access-Control-Allow-Credentials' header is ''. It must be 'true' to allow credentials. Origin   'http://127.0.0.1:5000' is therefore not allowed access.

I find a clue on
http://stackoverflow.com/questions/24687313/what-exactly-does-the-access-control-allow-credentials-header-do

So, it need 'Access-Control-Allow-Credentials' header


Reply to this email directly or view it on GitHub
#133.

from flask-cors.

guyskk avatar guyskk commented on August 16, 2024

thank you, I read the source code and find these options.

from flask-cors.

corydolphin avatar corydolphin commented on August 16, 2024

Great, thanks for the report! I have recently merged improvements to the documentation to make it easier to find (hopefully).

from flask-cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.