Forum rules
Under no circumstances is spamming or advertising of any kind allowed. Do not post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate others security. Profanity or any kind of insolent behavior to other members (regardless of rank) will not be tolerated. Remember, what you don’t find offensive can be offensive to other members. Please treat each other with the kind of reverence you’d expect from other members.
Failure to comply with any of the above will result in users being banned without notice. If any further details are needed, contact: “The team” using the link at the bottom of the forum page. Thank you.
mozartatplay
Posts: 3
Joined: Mon Jan 28, 2019 12:17 am

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

Sun Aug 27, 2023 8:22 pm

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

akneen
Posts: 2
Joined: Fri Sep 08, 2023 3:09 am

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

Fri Sep 08, 2023 3:30 am

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?

User avatar
oss
Site Admin
Posts: 6017
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

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

Sat Sep 09, 2023 12:12 pm

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.

akneen
Posts: 2
Joined: Fri Sep 08, 2023 3:09 am

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

Tue Sep 12, 2023 2:46 am

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!

ronalda2
Posts: 1
Joined: Wed Sep 13, 2023 8:47 am
Contact: Website

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

Wed Sep 13, 2023 8:51 am

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.

hyde84
Posts: 3
Joined: Tue Apr 12, 2022 11:00 am

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

Sat Jan 06, 2024 5:14 pm

s
Not worked. Still 403 appear, no matter what User-Agent I specify

hyde84
Posts: 3
Joined: Tue Apr 12, 2022 11:00 am

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

Sat Jan 06, 2024 5:43 pm

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"}'

User avatar
oss
Site Admin
Posts: 6017
Joined: Sat Feb 25, 2006 11:26 pm
Contact: Website

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

Sat Jan 06, 2024 6:10 pm

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)

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 3 guests