FastAPI (Python Framework) - Authentication APIs (Register, GET Token, Refresh Token, User Details)

preview_player
Показать описание
FastAPI is one of fastest Python framework for API development. It is not only fast in terms of performance, but it is sure and have easy to learn . Now days with the evolution of AI and ML, this is the most favourable framework for API development.

In this video tutorial you will learn how to create -
- how to configure MySQL in FastAPI
- how to configure connection pooling using SQLAlchemy
- User registration api
- JWT token (login api) api
- Refresh token api
- get authenticated user details api

Note: For the simplicity, refresh_token contains the same payload data as the access token, so it is possible to get the user details using the refresh_token too.

In a real world application you should make the following changes -
- Add a TTL (Time to Live) in the refresh_token
- Add different payload in the refresh_token and make sure payload information is unique for every refresh_token.

Additionally you will also learn how you can organise your project files and folders.

Рекомендации по теме
Комментарии
Автор

what i like about your video is you do your job with blind eyes not even debug it's okay when you do yourself but when you are teaching it's different

karapython
Автор

Great tutorial. It was challenging, but I managed to work my way to the end. Thanks a lot!

martinmiz
Автор

Awesome video. I learnt so much about authentication in general. I was looking to setup fastapi just like Django and this video helped me do that. Thank you 🙂

eduai-
Автор

this training is wider than just for JWT, but it's very good. It was difficult to go through MySQL setup though

alexeymatveev
Автор

Rather than using any db to store the id and passwd can we use any secure vault like hashicprp to save the details ?

Htyagi
Автор

what is the difference between access and refresh tokens? in this code u can use a refresh token as aceess for autorisation. so where is the safety here? besides, refresh token has no expiration time

fam
Автор

1. refresh token doesn't have expiration time,
2. use can access protected endpoints using both refresh token and access token.
refresh token should only be used to obtain new access token

it is not a good practice

sarkaran
Автор

Why your endpoints does not have lock icon for oauth2?

mehulmak
Автор

Hello, can you prepare video content by adding Rabbitmq, Kafka, Redis technologies into this API?

ibrahimethem
Автор

In 1:16:56, UserResponse should inherit BaseResponse not BaseModel.

girigaurav
Автор

Good

How can i setup database in mysql

Thanks

mdaslamknl