FastAPI — How to add basic and cookie authentication

Nils de Bruin
5 min readApr 16, 2019

Background

In my work as a Data Rebel, I encounter many challenges to help unlock, enrich and use data to help our customers. In the last couple of years, I have come to the conclusion that at this moment in time, the best way to scale and provide data-driven solutions is by creating API’s. These API’s can be used and consumed by your own API’s our by other consumers like for example a customer-faced website.

As our team makes use of Python in almost all cases, finding the right library can significantly speed up the development process. At this moment we use the Hug library a lot which has served us greatly, but I think it is important to keep an open mind and see what projects are started, evolve and become more mainstream.

Enter FastAPI

A couple of months ago I accidentally stumbled upon FastAPI. At first glance, I thought: “Hé this looks really interesting: solid documentation and a solid foundation (Starlette) ”, but I didn’t have the time to play around with it.

As time progressed, I felt that I had to try out FastAPI and I am really glad I did this! The ease of use, the documentation, the already great community and frequent updates, make it a joy to work with. Sebastián Ramírez, the founder of this project is, is a great guy who spends a lot of…

--

--

Nils de Bruin
Nils de Bruin

Responses (5)