feat(api): add API key authentication to backend endpoints
Add API key security using fastapi.security.APIKeyHeader to protect /v1/completions and /v1/ocr endpoints. Updated frontend to include X-API-Key header in API requests. Also changed default API base URL from http://149.104.29.239:8001 to https://api.learnteach.tech:8002.
This commit is contained in:
@@ -22,7 +22,10 @@ export async function fetchSuggestion(prefix, suffix, signal, apiUrl = API_URL)
|
||||
try {
|
||||
const settings = useSettingsStore()
|
||||
const clientIP = await getClientIP()
|
||||
const headers = { 'Content-Type': 'application/json' }
|
||||
const headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'X-API-Key': 'your-secret-key-here'
|
||||
}
|
||||
|
||||
// Only send IP if privacy mode is OFF
|
||||
if (clientIP && !settings.privacyMode) {
|
||||
|
||||
Reference in New Issue
Block a user