Page 1 of 1

Infos/User response = 403 forbidden

Posted: Wed Oct 05, 2022 12:45 am
by ribasman
Hi,
Start migrating to the new API and everything runs smoothly except for the GET method in infos/user
After Login (which i get a token) immediately i'm trying without success to get the remaining_downloads integer. A key part in my app code:
The remote server returned an error: (403) Forbidden

Btw infos/formats and infos/languages are almost identical in terms of headers and are working flawless

On the other and i think it will be less intensive for server to respond at Login all major user details like the remaining_downloads

PS.i know and it's working after one download that i receive those remaining available downloads

Looking forward for your reply and thanks in advance

Re: Infos/User response = 403 forbidden

Posted: Wed Oct 05, 2022 9:30 am
by oss
Hi

yes remaining downloads will be implemented, on login response. Are you sending also JWT?:

User token created in the login endpoint to authorise opensubtitles.com user
Provide your bearer token in the Authorization header when making requests to protected resources.
Example: Authorization: Bearer 123

Please read https://opensubtitles.stoplight.io/docs ... formations

Re: Infos/User response = 403 forbidden

Posted: Fri Oct 07, 2022 10:15 pm
by ribasman
persists in error 403.

queryUrl = "https://api.opensubtitles.com/api/v1/infos/user"
Dim wClient1 As New WebClient
wClient1.Headers("Accept") = "*/*"
wClient1.Headers("ContentType") = "application/json"
wClient1.Headers("Authorization") = String.Format("Bearer {0}", openSubUser.token)
Dim jsonObject1 As Object = JObject.Parse(wClient1.DownloadString(queryUrl))

openSubUser.token=token from json response on Login endpoint
I've already turned to false that consumerApi under development check.

Re: Infos/User response = 403 forbidden

Posted: Fri Oct 07, 2022 10:32 pm
by ribasman
Figure it out already. Missing api-key header of course.

queryUrl = "https://api.opensubtitles.com/api/v1/infos/user"
Dim wClient1 As New WebClient
wClient1.Headers("ContentType") = "application/json"
wClient1.Headers("Authorization") = String.Format("Bearer {0}", openSubUser.token)
wClient1.Headers("Api-Key") = openSubUser.apiKey
Dim jsonObject1 As Object = JObject.Parse(wClient1.DownloadString(queryUrl))

Re: Infos/User response = 403 forbidden

Posted: Sat Oct 08, 2022 10:18 am
by oss
good one :) but glad you find it out.