Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/themusharraf/fastapi-oauth2
FastAPI va token autentifikatsiyasi yordamida foydalanuvchilarni autentifikatsiya qilish
https://github.com/themusharraf/fastapi-oauth2
authentication authorization fastapi oauth2
Last synced: 7 days ago
JSON representation
FastAPI va token autentifikatsiyasi yordamida foydalanuvchilarni autentifikatsiya qilish
- Host: GitHub
- URL: https://github.com/themusharraf/fastapi-oauth2
- Owner: themusharraf
- Created: 2024-10-27T20:48:51.000Z (10 days ago)
- Default Branch: main
- Last Pushed: 2024-10-27T20:49:09.000Z (10 days ago)
- Last Synced: 2024-10-28T01:49:30.780Z (10 days ago)
- Topics: authentication, authorization, fastapi, oauth2
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FastAPI OAuth2
## Model
Bu kod `username` degan o'zgaruvchiga `str` yoki `None` qiymatlarini qabul qilish imkonini beradi. Keling, detallab tushuntirib beraman:```python
username: str or None = None
```
Bu yerdagi koddagi har bir qismning ma'nosi:- username: O'zgaruvchi nomi.
- `: str or None`: Bu "type hint" bo'lib, username o'zgaruvchisi str (string, ya'ni matn) yoki None qiymatini qabul qilishini bildiradi. str - matnni ifodalaydi, None esa qiymatning bo'sh yoki mavjud emasligini bildiradi.
- `= None`: O'zgaruvchiga boshlang'ich qiymat sifatida None berilmoqda. Bu shuni anglatadiki, dastur ishga tushganda username o'zgaruvchisi None qiymatiga ega bo'ladi va agar kerak bo'lsa, keyinroq str tipidagi qiymat bilan yangilanishi mumkin.
Qisqacha, bu kodda username o'zgaruvchisi boshida None qiymatiga ega bo'lib, agar kerak bo'lsa, matn (str) qiymat bilan almashtirilishi mumkin.## Secret ket generate
```bash
# openssl rand - hex 32
```## get password hash
```python
pwd = get_password_hash('mrx1234')
print(pwd)
```