Page 1 of 1

CORS error when trying to login

Posted: Sat Aug 26, 2023 1:26 pm
by stavby
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

Re: CORS error when trying to login

Posted: Sun Sep 10, 2023 10:45 am
by oss
hi it is still a problem ?

Re: CORS error when trying to login

Posted: Thu Jan 18, 2024 2:02 pm
by stavby
hi it is still a problem ?
Hi, yes.
It was resolved for a little while but now it seems to be back.

Re: CORS error when trying to login

Posted: Sun Jan 21, 2024 11:23 pm
by oss
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