DeepLcom / deepl-node

Official Node.js library for the DeepL language translation API.
MIT License
371 stars 22 forks source link

Bug while using deepl-node #7

Closed kertom closed 2 years ago

kertom commented 2 years ago

Hi , I have recently subscribed on Deepl Pro Advanced plan. I am trying to use deepl-node package: https://github.com/DeepLcom/deepl-node
However i get the following error : AuthorizationError: Authorization failure, check auth_key, message: Wrong endpoint. Use https://api.deepl.com at checkStatusCode I tried creating a new authentication key and I tried with it but no chance.I was wondering if you could help me, please?

mjpoo commented 2 years ago

Looking at index.ts it is odd if the serverUrl is being set tohttps://api-free.deepl.com if you are not using an API key that ends with :fx.

As a workaround you could try specifying the serverUrl in the options:

const authKey = "f63c02c5-f056-..."; // Replace with your key
const options = { serverUrl: 'https://api.deepl.com' };
const translator = new deepl.Translator(authKey, options);
daniel-jones-deepl commented 2 years ago

Hi @kertom, thank for reporting this issue. This problem is caused because the DeepL Pro Advanced plan does not include API access; for API access you need to use a DeepL API account.

The error message you received is a mistake on our end - we would instead expect an error message saying "This account is not allowed to access the API."

kertom commented 2 years ago

Hi, thank you very much for your responses! Following the suggestions of @mjpoo Mike , I have changed my code accordingly: https://codepen.io/thomas-kertsalis/pen/OJvZBxa?editors=1010
Now I get the error: AuthorizationError: Authorization failure, check auth_key, message: Wrong endpoint. Use https://api.deepl.com

@daniel-jones-deepl. What do you mean by that . After reading the following statement: “1. The Authentication Key for CAT tools is included in the DeepL Pro Advanced and DeepL Pro Ultimate subscription plans.” I made an annual subscription and I have already paid for it. What more do I have to do then? Do I have to buy the Deepl API Pro Ultimate package?

mjpoo commented 2 years ago

@kertom Hi Thomas, my suggested workaround was just a way to ensure that the correct serverUrl was being supplied (as the error message seemed to indicate this was the problem). It seems from @daniel-jones-deepl that the problem is caused by an account issue so he or DeepL support will be able to help you with that.

daniel-jones-deepl commented 2 years ago

Hi @kertom, with a DeepL Pro Advanced account you can use DeepL with CAT tools. You can find a list of CAT tools that support DeepL integration in DeepL Help Center.

This Node.js client library uses the DeepL API, which requires a DeepL API Free or DeepL API Pro account. If you have further account-related questions you are welcome to contact DeepL support as @mjpoo suggested.

AntonERG commented 1 year ago

@daniel-jones-deepl I just had same confusing "on-boarding user trip" of jumping from Starter to Advanced account until I've found this bug report.

It's a pretty confusing user experience, I was never able to find page with API account on my own.