Chore: moving changes - migrating Desktop from nobara 42 to windows(WSL)
This commit is contained in:
+32
-4
@@ -32,6 +32,8 @@ python scripts/create_admin.py
|
||||
### Run the Application
|
||||
```bash
|
||||
uvicorn app.main:app --reload
|
||||
# or
|
||||
fastapi run --reload app/main.py
|
||||
# API will be available at http://localhost:8000
|
||||
# Docs at http://localhost:8000/docs
|
||||
```
|
||||
@@ -63,20 +65,46 @@ uvicorn app.main:app --reload
|
||||
|
||||
## Authentication Usage
|
||||
|
||||
### Login Example
|
||||
### Getting a Bearer Token
|
||||
|
||||
First, you need to create an admin user (if you haven't already):
|
||||
```bash
|
||||
cd backend
|
||||
python scripts/create_admin.py
|
||||
```
|
||||
|
||||
Then login to get your bearer token:
|
||||
```bash
|
||||
curl -X POST "http://localhost:8000/api/v1/users/login" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"username": "admin", "password": "password"}'
|
||||
-d '{"username": "your_admin_username", "password": "your_password"}'
|
||||
```
|
||||
|
||||
### Using Token
|
||||
**Response:**
|
||||
```json
|
||||
{
|
||||
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...",
|
||||
"token_type": "bearer",
|
||||
"expires_in": 28800,
|
||||
"user": {
|
||||
"id": 1,
|
||||
"username": "admin",
|
||||
"role": "admin"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Copy the `access_token` value - this is your bearer token.
|
||||
|
||||
### Using the Bearer Token
|
||||
```bash
|
||||
# Include token in Authorization header
|
||||
curl -X GET "http://localhost:8000/api/v1/users/me" \
|
||||
-H "Authorization: Bearer YOUR_JWT_TOKEN"
|
||||
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
|
||||
```
|
||||
|
||||
**Note:** Replace `eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9...` with your actual token from the login response.
|
||||
|
||||
### Create User (Admin only)
|
||||
```bash
|
||||
curl -X POST "http://localhost:8000/api/v1/users/" \
|
||||
|
||||
Reference in New Issue
Block a user