Hello i have flask back end and vue front and i can not set cookie in browser.When I send cookie from flask to vue bruser give me worrning:
This set-cookie was blocked because it has the samesite=lax attribute but come from cross-site response witch was not the response to top-level navigation
Code:
from flask import Flask, make_response, jsonify
from flask_cors import CORS
app = Flask(__name__)
CORS(app, supports_credentials=True, resources={r"/*": {"origins": "*"}})
@app.route('/', methods=['GET'])
def index():
resp = make_response(jsonify({'message': 'Hello new flask'}))
resp.set_cookie('key', 'hello', samesite='Strict', secure=True)
return resp, 200
Try to set the SameSite
property to None
and use https.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With