txl.el icon indicating copy to clipboard operation
txl.el copied to clipboard

How to fix Authorization failed?

Open RidaAyed opened this issue 2 years ago • 4 comments

With region marked e.g. "Guten Tag"

C-x t txl-translate-region-or-paragraph

Authorization failed. Please supply a valid authkey parameter

(add-to-list 'load-path "~/src/txl.el")
(require 'txl)
(setq txl-languages '(DE . EN-US))
(setq txl-deepl-api-key "my_free_dev_deepl_api_key")
(global-set-key (kbd "C-x t")   'txl-translate-region-or-paragraph)

.

curl -H "Authorization: DeepL-Auth-Key my_free_dev_deepl_api_key" https://api-free.deepl.com/v2/usage

{"character_count":0,"character_limit":500000}

Nice work, thank you

RidaAyed avatar Mar 20 '22 09:03 RidaAyed

You're configuration looks fine to me. Perhaps the free dev key doesn't work for this purpose? Worth checking with DeepL.

tmalsburg avatar Mar 21 '22 12:03 tmalsburg

Changing the domain according to their api introduction solved the issue

Excerpt api introduction

...Please note that the API domain is different for each DeepL API plan, so please make sure to use the correct domain.

RidaAyed avatar Mar 21 '22 13:03 RidaAyed

Interesting. I wasn't aware of that. Will have to add something to the documentation. Thanks!

tmalsburg avatar Mar 21 '22 14:03 tmalsburg

I added a new defcustom for the API URL. Please see here and let me know if it works. And sorry: only now I noticed that you had made a PR. In my e-mail program it looked like an issue. Either way, thanks for your contribution.

tmalsburg avatar Mar 21 '22 19:03 tmalsburg