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.
stavby
Posts: 3
Joined: Sat Aug 26, 2023 1:17 pm

CORS error when trying to login

Sat Aug 26, 2023 1:26 pm

Hi, I'm using the API and it has worked great for the last few months. Lately I started getting CORS errors when trying to use it.

The request I'm sending:

Code: Select all

curl 'https://api.opensubtitles.com/api/v1/login' \ -H 'sec-ch-ua: "Chromium";v="116", "Not)A;Brand";v="24", "Google Chrome";v="116"' \ -H 'DNT: 1' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36' \ -H 'access-control-allow-methods: GET, HEAD, POST, OPTIONS' \ -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7KYD8gVF1UxGs6rB' \ -H 'access-control-allow-origin: *' \ -H 'Accept: */*' \ -H 'Referer: http://127.0.0.1:5173/' \ -H 'api-key: <MY_API_KEY>' \ -H 'access-control-allow-headers: Origin, Authorization, Accept, Api-Key, Content-Type, X-User-Agent' \ -H 'sec-ch-ua-platform: "Windows"' \ --data-raw $'------WebKitFormBoundary7KYD8gVF1UxGs6rB\r\nContent-Disposition: form-data; name="username"\r\n\r\nasf\r\n------WebKitFormBoundary7KYD8gVF1UxGs6rB\r\nContent-Disposition: form-data; name="password"\r\n\r\nasf\r\n------WebKitFormBoundary7KYD8gVF1UxGs6rB--\r\n' \ --compressed
What can I do to fix it? It seems that the server is not including the Access-Control-Allow-* header

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

Re: CORS error when trying to login

Sun Sep 10, 2023 10:45 am

hi it is still a problem ?

stavby
Posts: 3
Joined: Sat Aug 26, 2023 1:17 pm

Re: CORS error when trying to login

Thu Jan 18, 2024 2:02 pm

hi it is still a problem ?
Hi, yes.
It was resolved for a little while but now it seems to be back.

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

Re: CORS error when trying to login

Sun Jan 21, 2024 11:23 pm

very strange, works for me, send your curl:
curl --request POST \
--url 'https://api.opensubtitles.com/api/v1/login?=' \
--header 'Api-Key: <API>' \
--header 'Content-Type: application/json' \
--header 'User-Agent: <UA> v1.1' \
--data '{
"username": "username",
"password": "password"
}'
output
< HTTP/2 200
< date: Sun, 21 Jan 2024 21:21:03 GMT
< content-type: application/json; charset=utf-8
< content-length: 314
< x-ratelimit-remaining-hour: 59
< x-ratelimit-limit-hour: 60
< ratelimit-reset: 1
< ratelimit-remaining: 0
< ratelimit-limit: 1
< x-ratelimit-remaining-second: 0
< x-ratelimit-limit-second: 1
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
< x-download-options: noopen
< x-vip-consumer: false
< x-vip-user: false
< cache-control: max-age=0, private, must-revalidate, s-maxage=600
< access-control-allow-origin: *
< access-control-allow-methods: GET, HEAD, POST, OPTIONS
< access-control-allow-headers: Origin, Authorization, Accept, Api-Key, Content-Type, X-User-Agent
< x-request-id: 9d2b3c44-4737-4b33-9dfe-3235389cb7d7
< x-runtime: 0.282526
< x-kong-upstream-latency: 284
< x-kong-proxy-latency: 2
< x-cache-backend: apigw1_8000 rb1-temp
< age: 0
< x-var-cache: MISS
< x-via: fw1
< x-opensubtitles-message: User-Agent header is wrong - can not parse version of App; add version eg: myuseragent v1.2.3
< accept-ranges: bytes
< cf-cache-status: DYNAMIC
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=fAjJbFY%2B5axvafs70LixMmkYeXa%2BKWH1gPK5fbUrarLDVG%2FwlhSSMd9DceN7Zu2%2BuuQPLyHDMpQsMRid3Zdj5sNK0krVd6VcfW507Sv4a65PnvqzTg8zBfMcp48GVHgOiuUut3U5laJ9sSRVcMSnGDNZrxE%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< strict-transport-security: max-age=15552000; includeSubDomains; preload
< server: cloudflare
< cf-ray: 84929acc29296737-ATL
< alt-svc: h3=":443"; ma=86400

Return to “Developing”

Who is online

Users browsing this forum: No registered users and 20 guests