0

I am currently in the process of building an REST API with flask-security. Fortunately flask-security has a lot of views and templates, which i won't need in my case. I am obviously not able to override them by reimplementing e.g. @app.route('/login') with my own logic.

So the simple question is, how do i disable all the views from flask-security which returns a template?

JavaCake
  • 4,075
  • 14
  • 62
  • 125

1 Answers1

1

I don't think that you can disable directly because none of the flask exposed APIs have disabled state. You can customize the views like this below sample:

Here is the link for reference: Flask Security

security = Security(app, user_datastore)

# This processor is added to all templates
@security.context_processor
def security_context_processor():
    return dict(hello="world")

# This processor is added to only the register view
@security.register_context_processor
def security_register_processor():
    return dict(something="else")

Hope it helps.

Ranadip Dutta
  • 8,857
  • 3
  • 29
  • 45
  • I understand. But i cannot tear down the template/view? I do not want pages like the one on the login to be accessed as i want to run pure REST API style. – JavaCake Jan 14 '17 at 12:27
  • I believe you should only use Flask login then instead of Flask-security because you do not want to deal with the views directly. – Ranadip Dutta Jan 14 '17 at 12:42