-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2/translate 接口的 Authorization 头和官方不一致 #104
Comments
请注意 authkey 和 token 在 DeepLX 中不是一个东西! 在 DeepLX 中 authkey 是当免费的 API 用到 IP 被封之后,才会透过 authkey 使用官方的付费 API。所以 authkey 在大部分情况下不是必须的参数。 而 Bearer 中的 token 可以理解为 accesstoken 仅仅只是为了保护您公开的 API 不被滥用。 所以,在你没有设置 accesstoken 的情况下,可以直接无视 Authorization,请求 /v2/* 相关的 API。 |
当然,我可以将 Authorization 用来验证 accesstoken,但是在这种情况下,会丢弃掉 authkey 的传递,如果频繁使用出现 429 之后,您将无法继续使用翻译服务。 我不确定用户更想要的是在和官方一致的 Authorization 中传递 authkey 还是 accesstoken。 |
我明白这一点,我部署服务时设置的是 token,我的 authkey 已经被官方封掉了。。。我觉得,大部分需要 DeepLX 服务的用户应该都是没办法通过正规渠道获取官方 authkey 😥 |
OK,晚些时候我改下代码,支持对 accesstoken 的验证。 |
如果是考虑到这一点,那我觉得可以通过判断 Authorization 的值来决定,因为官方的 key 都是以 :fx 结尾。 另外,也可以在 DeepLX 部署文档中说明一下这一点,提示用户不要将 token 设置的和官方 auth_key 格式一样,避免问题。 |
Great ❤️ |
这个 issue #99 实现了 DeepLX 接口替换官方接口,方便在各种翻译软件中使用。
今天我在使用 Raycast-Easydict 测试 自定义 DeepL 地址 时遇到问题,如果部署 DeepLX 时设置了 Authorization,DeepLX 的请求格式是
Bearer $token
,而 DeepL 官方接口 格式是DeepL-Auth-Key $token
,从而导致认证失败。希望能够兼容官方的 Authorization 头,实现完美替换官方接口。
The text was updated successfully, but these errors were encountered: