Proper way for user authentication with angularjs and flask

时光总嘲笑我的痴心妄想 提交于 2020-01-30 14:17:32

问题


I'm currently working my way through Web development with flask. I want to build a webapp with flask as backend and angular.js at the frontend. The Json part is straight forward, and my first steps work out well. But now I got stuck with User Authentication. I read a lot but found out, that WTFForms works not as well with angular (without the CSFR Token), so i can not use something like flask-security.

What is a proper way or maybe the best pratice for implementing User authentication with Angular und Flask? (Maybe someone knows a good example app I can learn from by example)


回答1:


I have written several tutorials on RESTful APIs with Flask, all with examples that are ready to use:

http://blog.miguelgrinberg.com/category/REST

The tutorials are:

  • Designing a RESTful API with Python and Flask

    This is a simple RESTful API written in Flask, with authentication.

  • Writing a Javascript REST client

    In this one I implement a Javascript client for the API built in the first tutorial. Here you can see how the client authenticates. I used Knockout instead of Angular for the client, but the principles are the same.

  • Designing a RESTful API using Flask-RESTful

    This one is another way to write the server, using the Flask-RESTful extension to simplify some tasks.

  • RESTful Authentication with Flask

    This is a tutorial specifically dedicated to authentication.

I hope they are useful.



来源:https://stackoverflow.com/questions/21634682/proper-way-for-user-authentication-with-angularjs-and-flask

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!