fix: update DeepL API to header-based authentication
All checks were successful
CI / update (push) Successful in 1m30s

DeepL deprecated form-body authentication (auth_key in request body).
Now using Authorization header as required by the API.
This commit is contained in:
2026-01-28 15:09:34 +01:00
parent baee021869
commit 9db2009777

View File

@@ -149,7 +149,6 @@ class DeepLTranslationService {
const preprocessedText = replaceGermanCookingTerms(text);
const params = new URLSearchParams({
auth_key: this.apiKey,
text: preprocessedText,
target_lang: targetLang,
...(preserveFormatting && { tag_handling: 'xml' })
@@ -159,6 +158,7 @@ class DeepLTranslationService {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `DeepL-Auth-Key ${this.apiKey}`,
},
body: params.toString()
});
@@ -218,7 +218,6 @@ class DeepLTranslationService {
try {
const params = new URLSearchParams({
auth_key: this.apiKey,
target_lang: targetLang,
});
@@ -231,6 +230,7 @@ class DeepLTranslationService {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': `DeepL-Auth-Key ${this.apiKey}`,
},
body: params.toString()
});