Default User Authentication
Sprout currently uses a hardcoded default user for simplicity during development. All requests are associated with this user.
Default User ID
const DEFAULT_USER_ID = "00000000-0000-0000-0000-000000000000";
This user is automatically created on server startup:
{
"id": "00000000-0000-0000-0000-000000000000",
"email": "[email protected]",
"title": "Default Learner"
}
Using the Default User
Include the default userId in request bodies for endpoints that require it:
curl -X POST http://localhost:8000/api/branches \
-H "Content-Type: application/json" \
-d '{
"title": "My Learning Path",
"userId": "00000000-0000-0000-0000-000000000000"
}'
Future Authentication
In production, you would:
- Implement proper user registration/login
- Use JWT tokens or session cookies
- Add authentication middleware to verify requests
- Replace the default user with real user accounts
The default user authentication is not suitable for production. It’s designed for local development and testing only.
Required User Fields
Most endpoints require a userId parameter:
The UUID of the user. Use the default user ID for development:
00000000-0000-0000-0000-000000000000
Example: Creating a Branch
curl -X POST http://localhost:8000/api/branches \
-H "Content-Type: application/json" \
-d '{
"title": "Machine Learning Fundamentals",
"userId": "00000000-0000-0000-0000-000000000000"
}'
Response:
{
"id": "a1b2c3d4-e5f6-4a5b-8c9d-0e1f2a3b4c5d",
"title": "Machine Learning Fundamentals",
"userId": "00000000-0000-0000-0000-000000000000",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:30:00.000Z"
}