Coder Social home page Coder Social logo

Comments (4)

rejown avatar rejown commented on May 16, 2024

In our design, the HTTP RESTful API will not accept cookies, it accept token in the request header. In other words, the RESTful API is not browser-oriented.
The main reason is the cookies are unsafe. you can google "restful api + cookies" for more information about this subject.
The appropriate authentication approach is OAuth and scope in the swagger specification:
http://swagger.io/specification/#securityDefinitionsObject
For the browser usage, you should implement your own cookies business.

from swagger-py-codegen.

LouisZou avatar LouisZou commented on May 16, 2024

Thanks.
Now my Http RESTful API is designed to need cookie to get the authentication, that's meaning, I need to change it.
Is there any other method if using the current model?

from swagger-py-codegen.

rejown avatar rejown commented on May 16, 2024

The swagger-py-codegen generated code is not a complete app, but only a skeleton. you can change and extend the skeleton code on your own way, even custom the code template.
There is nothing magic, the generated code is just a flask app(precisely flask-restful app), so extend the app should follow the flask way(and flask-restful).
some links maybe useful:
http://flask.pocoo.org/docs/0.10/quickstart/#sessions
https://flask-login.readthedocs.org/en/latest/
http://flask.pocoo.org/snippets/3/

from swagger-py-codegen.

LouisZou avatar LouisZou commented on May 16, 2024

Thanks Rejown.
I'am studying the swagger and Flask in Python.

from swagger-py-codegen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.