Page 1 of 1

Can't authenticate with opensubtitles code code 403 and code 400

Posted: Sun Aug 27, 2023 8:22 pm
by mozartatplay
Hi

My API code suddenly stopped working on 23 August 2023

curl --request POST \
--url https://api.opensubtitles.com/api/v1/login \
--header 'Accept: application/json' \
--header 'Api-Key: <insert my key>' \
--header 'Content-Type: application/json' \
--data '{
"username": “my username,
"password": "my password"
}'

response
<!DOCTYPE html>
<html>
<head>
<title>403 User-Agent header is wrong; set it to App name with version eg: MyApp v1.2.3</title>

I've never seen that 403 saying it needs and App name - so added this but now

curl --request POST \
--url https://api.opensubtitles.com/api/v1/login \
--header 'Accept: application/json' \
--header 'Api-Key: <insert my key>' \
--header 'Content-Type: application/json' \
--header 'User-Agent: myapp v1' \
--data '{
"username": “my username,
"password": "my password"
}'

{"status":400,"error":"Bad Request"}

Has something changed - the documentation at Stoplight is not saying that the API has changed

Thanks
David

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Fri Sep 08, 2023 3:30 am
by akneen
I've been seeing the same thing since about the same time:

Code: Select all

$ curl --request POST --url https://api.opensubtitles.com/api/v1/login --header "Accept: application/json" --header "Api-Key: ${OPENSUBTITLES_API_KEY}" --header "Content-Type: application/json" --data "{ 'username': '${OPENSUBTITLES_USERNAME}', 'password': '${OPENSUBTITLES_PASSWORD}' }"
<!DOCTYPE html>
<html>
<head>
<title>403 User-Agent header is wrong; set it to App name with version eg: MyApp v1.2.3</title>
</head>
<body>
<h1>Error 403 User-Agent header is wrong; set it to App name with version eg: MyApp v1.2.3</h1>
<p>User-Agent header is wrong; set it to App name with version eg: MyApp v1.2.3</p>
<h3>Guru Meditation:</h3>
<p>XID: 174620892</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>

..confirmed from my regular IP, as well as two other previously-unused IPs.

@oss, any ideas?

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Sat Sep 09, 2023 12:12 pm
by oss
Hi

yes we now require to have User-Agent present in requests, set it up to your application/script name with version, like "Kodi Plugin v0.1"

Code: Select all

curl --request POST \ --url 'https://api.opensubtitles.com/api/v1/login' \ --header 'Api-Key: <API-KEY>' \ --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ --header 'User-Agent: myapp v1' \ --data '{ "username": "<username>", "password": "<password>" }'
this works for me.

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Tue Sep 12, 2023 2:46 am
by akneen
yes we now require to have User-Agent present in requests, set it up to your application/script name with version, like "Kodi Plugin v0.1"
I've confirmed this (specifying a non-stock user-agent) works for me.

thanks!

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Wed Sep 13, 2023 8:51 am
by ronalda2
yes we now require to have User-Agent present in requests, set it up to your application/script name with version, like "Kodi Plugin v0.1"
I've confirmed this (specifying a non-stock user-agent) works for me.

thanks!
Error code 403 usually indicates that access to the requested resource is forbidden. This could be due to various reasons, such as incorrect credentials, IP restrictions, or limitations imposed by the OpenSubtitles service itself. To resolve this issue, double-check your login credentials and ensure that they are entered correctly. If you continue to experience difficulties, you may need to contact OpenSubtitles support for further assistance.

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Sat Jan 06, 2024 5:14 pm
by hyde84
s
Not worked. Still 403 appear, no matter what User-Agent I specify

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Sat Jan 06, 2024 5:43 pm
by hyde84
These params work
curl --request POST --url https://api.opensubtitles.com/api/v1/login --header "Accept: application/json" --header "Api-Key: KEY" --header "Content-Type: application/json" --header "User-Agent: NAME v1" --data '{"username": "LOGIN", "password": "PASSWORD"}'

Re: Can't authenticate with opensubtitles code code 403 and code 400

Posted: Sat Jan 06, 2024 6:10 pm
by oss
thanks for sharing what works for you.

it is about specifying your User-Agent (app name) in header... like

--header "User-Agent: NAME v1" (instead of "NAME" use real application name)