Page 1 of 1

Bazarr 1.2.4 Issue

Posted: Sun Jul 23, 2023 3:42 pm
by korrath83
Hi,

I signed up for VIP membership yesterday and have been trying to incorporate opensubtitles.com into bazarr and having followed all guidance on the bazarr discord and github I have read that this now appears to be an issue with open subtitles. Since 1.2.4 has been released the authentication error has changed from too many request even though it was 0/1000 to now saying login failed. I have reset the bazarr cache, attempted a full clean install of bazarr and also changed my password to something much more simple on opensubtitles.com but yet i still received the "login failed" with the logs.

Any help would be appreicated.

Thanks

Re: Bazarr 1.2.4 Issue

Posted: Sun Jul 23, 2023 11:19 pm
by tecnobrat
I just did a little debugging. It appears bazarr is receiving a `invalid token` error when trying to use the download endpoint of the API.

Searching appears to be working, but downloads return a 401 with the above error.

I did some extra debugging. If I use curl with the same API key and token as bazarr is using, it fails. However I created my own API key in my OS account, and I used that instead of the hardcoded bazarr API key (using curl again) and it worked.

So my guess is there is either something wrong with the bazarr API key, or something wrong on OS's API.

Here is a slightly redacted log from bazarr: https://gist.github.com/tecnobrat/7079c ... a4ef6c4193

And my testing:
[bstolz@owl ~] curl --request POST \
--url https://api.opensubtitles.com/api/v1/download \
--header 'Accept: application/json' \
--header 'Authorization: Bearer REDACTED' \
--header 'Content-Type: application/json' \
--header 'Api-Key: s38zmzVlW7IlYruWi7mHwDYl2SfMQoC1' \
--data '{ "file_id": 7203216 }'

{"message":"invalid token","uk":"app_166_REDACTED","uid":2,"ts":1690146711}%

[bstolz@owl ~] curl --request POST \
--url https://api.opensubtitles.com/api/v1/download \
--header 'Accept: application/json' \
--header 'Authorization: Bearer REDACTED' \
--header 'Content-Type: application/json' \
--header 'Api-Key: MY_API_KEY' \
--data '{ "file_id": 7203216 }'

{"link":"REDACTED","file_name":"American Gods (2017) - S01E03 - Head Full of Snow [Bluray-1080p][10bit][x265][AAC 5.1]-RAR.srt","requests":1,"remaining":4,"message":"Your quota will be renewed in 2 hours and 47 minutes (2023-07-23 23:59:59 UTC) ts=1690146745 ","reset_time":"2 hours and 47 minutes","reset_time_utc":"2023-07-23T23:59:59.999Z","uk":"app_50246_REDACTED","uid":2,"ts":1690146745}
Now that I look closer, I'm 99% sure this issue is on OS's end. I have a VIP account and its saying that my limit there is only 5, which means that OS thinks I am making this request unauthenticated.

Re: Bazarr 1.2.4 Issue

Posted: Mon Jul 24, 2023 7:01 am
by oss
Hi

thanks for report. It is quite strange - but lets fix it. So what I did is in curl:
- called /login, have token, /download endpoint with token -> I get link
- if you are logged in, /login will always sends you same token (thats new)
- you can call /logout with DELETE method and jwt token to log out you and then /login will get new token.

you can also send me your JWT token via PM to have a look, wondering if it is expired.

Re: Bazarr 1.2.4 Issue

Posted: Mon Jul 24, 2023 4:12 pm
by tldm
I have also been having the same issue for the last couple of days. Getting the invalid token error until around 10:00 UTC. after that everything works for a little while.

Manually clearing the token seems to work for a temporary fix though, Thanks.

Also,it may be worth noting in the API documentation that the "API Key" header is required for the logout request.

Re: Bazarr 1.2.4 Issue

Posted: Mon Jul 24, 2023 4:37 pm
by tecnobrat
I did inspect the JWT, and it was not expired.

However, I did try it again this morning and now its working. My JWT is valid and the response shows the correct VIP rate limits.

The expiry on my current JWT is in 23 hours. The token i was using last night expired in a few hours, but it was still valid (and yes, I paid attention to UTC).

Re: Bazarr 1.2.4 Issue

Posted: Mon Jul 24, 2023 5:08 pm
by os_dev
I did inspect the JWT, and it was not expired.

However, I did try it again this morning and now its working. My JWT is valid and the response shows the correct VIP rate limits.

The expiry on my current JWT is in 23 hours. The token i was using last night expired in a few hours, but it was still valid (and yes, I paid attention to UTC).
everything should work now, there was a little mixup of expiration times in the caching mechanism that was fixed this morning.