avatar Bite 345. FastAPI Authentication with JWT (JSON Web Tokens)

Up to this point anyone can modify food entries in the food log API, for any user!

That is not desired and in this Bite we will have you lock down the API.

You'll work through the OAuth2 with Password (and hashing), Bearer with JWT tokens guide adding all the pieces to effectively make the API secure using using JWT tokens and secure password hashing. You'll use FastAPI's elegant Depends() to lock down the endpoints that were copied over from a previous Bite.

Good luck!

This Bite concludes the FastAPI learning path. Stay tuned for an SQLModel learning path where we build a similar API but using an ORM / database for persistence.

If you have any feedback on this learning path use the feedback form upon completing any of the Bites or hit us up directly on Slack.

Login and get coding
go back Advanced level
Bitecoin 10X

11 out of 14 users completed this Bite.
Will you be Pythonista #12 to crack this Bite?
Resolution time: ~93 min. (avg. submissions of 5-240 min.)

Focus on this Bite hiding sidebars, turn on Focus Mode.
We use Python 3.8