0

I am using an application factory and running into trouble excluding some routes from csrf_token. The csrf exexmpt works for the entire crud_bp. But how would I exclude only certain routes. I have tried csrf.exempt(crud_routes.crud_bp.notprotected) I removed csrf.exempt(crud_routes.crud_bp) and tried using @csrf.exempt after the notprotected route but it fails as well.

csrf = CSRFProtect()

def create_app():

app = Flask(__name__,instance_relative_config=False)
csrf.init_app(app)

with app.app_context():
    from .routes import game_routes
    from.routes import crud_routes
    app.register_blueprint(game_routes.game_bp)
    app.register_blueprint(crud_routes.crud_bp,url_prefix='/crud/')
    csrf.exempt(crud_routes.crud_bp)
return app
 

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.