#weebster-python-cors

1 messages · Page 1 of 1 (latest)

cedar gobletBOT
prime kraken
#

weebster-python-cors

#

Hey @lament adder ! Do you have a bit more details? What CORS error? Which exact part of the entire code triggers it? What did you change from the code?

lament adder
#

The call from checkout.js on line 19 for creating a payment intent is getting cors error. I have only changed the payment button's text in checkout.html and added
`from flask_cors import CORS, cross_origin
CORS(app)

@app.route("/")
@cross_origin(origin='*')`
to the server.py file

prime kraken
#

What is the exact CORS error though? Sorry, I need more details to try and help you

lament adder
#

the error message in my browser's console is: Access to fetch at 'file:///C:/create-payment-intent' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted

prime kraken
#

okay so that's your problem. This should be a real URL. If you developer locally you are supposed to render that view/file from a local server

lament adder
#

I'm looking through that section... should the page itself also be served by the flask server?

prime kraken
#

yes