tgorgdotcom / locast2plex

A very simple script to connect locast to Plex's live tv/dvr feature.
MIT License
234 stars 43 forks source link

Error in function login: Forbidden #272

Open tmwebb2 opened 3 years ago

tmwebb2 commented 3 years ago

I ma getting the error below. I allowed a Microsoft update and rebooted the laptop. Happens on my desktop and laptop.

C:\locast2plex>python3 main.py Initiating Locast2Plex v0.6.5 Opening and Verifying Configuration File. C:\locast2plex\config\config.ini C:\locast2plex\config.ini Loading Configuration File: C:\locast2plex\config.ini Tuner count set to 3 Server is set to run on 127.0.0.1:6077 UUID set to: zkqzpils... Getting user location... Getting location via IP Address. Got external IP 99.64.87.111. Got location as Atlanta - DMA 524 - Lat\Lon 34.0663-84.6784 Logging into Locast using username notmyreal@comcast.net... Error in function login: Forbidden Invalid Locast Login Credentials. Exiting...

rqbanerjee commented 3 years ago

I am also seeing this, starting today. docker on a Synology NAS (Linux). I can use the same credentials to log into the website. Maybe Locast did a bad deployment, or changed their API endpoint for logins?

jg-24 commented 3 years ago

Locast apparently started enforcing a captcha implemented with Google ReCaptcha.

seakurt commented 3 years ago

Same issue after restarting. Windows 10.

jg-24 commented 3 years ago

For the developers: try using a hardcoded client ID and captcha in the locast api calls. The ID is currently hardcoded in website static objects so it may change and the captcha appears have just been added as a required field but is not being enforced/checked yet (so it will certainly change). Kudos to other developers for figuring this out so quickly...

https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D

credentials = { "username": username, "password": password, "captcha": "anything" }

purduepete commented 3 years ago

For the developers: try using a hardcoded client ID and captcha in the locast api calls. The ID is currently hardcoded in website static objects so it may change and the captcha appears have just been added as a required field but is not being enforced/checked yet (so it will certainly change). Kudos to other developers for figuring this out so quickly...

https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D

credentials = { "username": username, "password": password, "captcha": "anything" }

This worked for me. I altered line 55, of the file, lib/locast_service.py to match the above (see below code snippet)

loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D', ('{"username":"' + username + '","password":"' + password + '", "captcha": "anything"}').encode("utf-8"), {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT})

Thank you jg-24.

tmwebb2 commented 3 years ago

This worked for me as well. Thank you all for jumping on this so quickly.

seakurt commented 3 years ago

Worked here too! Thank you soooooo much!

SVRapture commented 3 years ago

I hate to be so stupid (I know I am missing something). I am running locast2plex on a Windows10 box. I made the change above to the locast_service.py file but it still would not work. So I hard coded my username in the locast.service.py file and it is still using the one in my config.ini file. Clearly it is not using the changed .py file. Do I need to compile it or something?

I discovered my error - I had to change the link as well as add the captcha.

Thank you for the quick work!

jwarner75 commented 3 years ago

I am having this very same issue.

I have 2 machines, 1 a Quad Core running Locast2plex and 1 8 Core running Locast2plex both connected to the network and I just had this issue. Both of them are not wanting to connect.

I even made the changes to the file as suggested above and it's not helping either.

Some help would be appreciated to help me get up and running!

Thanks!

mazinkhu commented 3 years ago

Can someone please advice where do you find the file locast_service.py, when using locast2plex as docker container in Synology NAS.

Nbr1Sniper commented 3 years ago

For the developers: try using a hardcoded client ID and captcha in the locast api calls. The ID is currently hardcoded in website static objects so it may change and the captcha appears have just been added as a required field but is not being enforced/checked yet (so it will certainly change). Kudos to other developers for figuring this out so quickly... https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D credentials = { "username": username, "password": password, "captcha": "anything" }

This worked for me. I altered line 55, of the file, lib/locast_service.py to match the above (see below code snippet)

loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D', ('{"username":"' + username + '","password":"' + password + '", "captcha": "anything"}').encode("utf-8"), {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT})

Thank you jg-24.

THANK YOU!!! If anyone can't find the file its in locast2plex\lib and named: locast_service

jwarner75 commented 3 years ago

For the developers: try using a hardcoded client ID and captcha in the locast api calls. The ID is currently hardcoded in website static objects so it may change and the captcha appears have just been added as a required field but is not being enforced/checked yet (so it will certainly change). Kudos to other developers for figuring this out so quickly... https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D credentials = { "username": username, "password": password, "captcha": "anything" }

This worked for me. I altered line 55, of the file, lib/locast_service.py to match the above (see below code snippet) loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D', ('{"username":"' + username + '","password":"' + password + '", "captcha": "anything"}').encode("utf-8"), {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT}) Thank you jg-24.

THANK YOU!!! If anyone can't find the file its in locast2plex\lib and named: locast_service

I found the file. And I made the change just like that.

I'll list it below to show my modification.

       loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login',
                                          ('{"username":"' + username + '","password":"' + password + '", "captcha": "anything"}').encode("utf-8"),
                                          {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT})

I just added it in, I didn't copy the code from here and copied it over.

jwarner75 commented 3 years ago

Ok, I just figured it out, it took me a Minute.

For anyone NEEDING Help with this.

Copy and paste this Code OVER The other one.

  ```

loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D', ('{"username":"' + username + '","password":"' + password + '","captcha": "anything"}').encode("utf-8"), {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT})


You WILL Need to Add in the top (https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D) This will get copied over top of the line that says (loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login',) and replaced with the one above.

And then "captcha": "anything" will be added as well.

I included the corrections in the code above.
jwarner75 commented 3 years ago

Ok, Last comment lol.

I'm SOOO Very new to this...

But I "Forked" the file. Made changes to the Locast file as directed above with the changes. Then I uploaded the file with the changes.

So I think all you got to do is download the amended files, copy over existing one (Except for the Config.ini), you'll wanna make a copy of that so you don't over right the info and have to enter it all again. Then copy it over. Screenshot 2021-08-04 181819

Here is a Screen Shot of the changes made from the file.

joerich commented 3 years ago

purduepete

Thank you so much! your fix worked perfectly!

bulfinch commented 3 years ago

Any advice for us non developer types running this in docker on synology?

ratherDashing commented 3 years ago

@bulfinch I fixed it in the official docker container by doing this: docker cp locast2plex:/app/lib/locast_service.py . then edit the file with the code above then copied it back docker cp locast_service.py locast2plex:/app/lib/ then restarted the container. make sure the indentation matches up with the previous code (which I just commented out) as python cares about that stuff.

jaimelalone commented 3 years ago

Thanks all for the fix. Best to simply copy pasta!

LLCoolWas commented 3 years ago

Is this still working for those of you that applied the change? I tried editing in the client_id into my docker container's files, but it and copying the locast_service.py file from @jwarner75 but it is still giving me an invalid creds error since the update.

jwarner75 commented 3 years ago

@LLCoolWas Wish I could help you with this issue. I don't know anything about Docker Containers.

I WAS going to install Docker if I couldn't get Python to work when I originally started having some issues with it. It just took me getting away from it for a little while.

I wish I knew MORE about python and the programming.

it took me a few minutes to fix the issue i was having with the Client ID that someone else figured out to get it working. it turned out i was missing a line.

Once i figured it out, I just saved it and I forked the codes and saved the change to the file and uploaded it to the forked files that way someone could just download the updated file, copy over top and should be able to get it to work.

I didn't think about the Docker, Someone else would probably be better to assist you on that that is more knowledgeable about it than me.

jwarner75 commented 3 years ago

@LLCoolWas it looks like @ratherDashing has a fix for it, Check out his method in the post comments

mazinkhu commented 3 years ago

Hi, Thank you everyone for the help. For those of you who are new to all this like me. Just some detailed steps of how I accessed the files. I am using the Synology NAS DS220+, and do not have a software background.

FYI: I used the container from Synology Docker registry as shown below: a1

step1: You will need to access a ssh terminal, to use the docker cp commands. step 2: You will need to know the name of the container for you installation. This can be done by clicking the "Edit" tab under the docker container. i2

step 3: In the ssh terminal window, you will issue the docker cp command to copy the file.Please make sure you use the container name from step2 for the "docker cp" command.(you will need to be root for all the commands below) docker cp tgorg-locast2plex1:/app/lib/locast_service.py . You can then use the ls command as shown below, to see if the file get copied.

i3

Step 4: Modify the copied file, as indicated in the forum. Step 5: Copy back the file to the docker container.

cp locast_service.py tgorg-locast2plex1:/app/lib/locast_service.py

tgorgdotcom commented 3 years ago

Hello all. Thanks for all your work into figuring this out. Let me see if I can integrate the changes to a new version.

jwarner75 commented 3 years ago

@tgorgdotcom I'm no expert on writing scripts, I forked the files and I made changes to the file that was needed and saved it, I wasn't sure if i could upload to your files or not so I just forked, made changes and uploaded it.

rkendry commented 3 years ago

I use Unraid and I cannot figure out where the files are stored to modify the locast_service.py. i might need to just wait for an update to the docker image.

patrick-GH commented 3 years ago

I use Unraid and I cannot figure out where the files are stored to modify the locast_service.py. i might need to just wait for an update to the docker image.

You have to pull the file out of the container then add it back in. I'm no expert either, but will take a look tonight

drewwats commented 3 years ago

This fix did not work for me. Latest locast2plex image, Docker container on Synology.

mazinkhu commented 3 years ago

Can you please post your modifications, as I have had no problems. Please make sure the indentation does not change for the lines modified. Below are my modifications, I commented out the old lines and matched the original indentation. Capture

tgorgdotcom commented 3 years ago

Hello all. I. just pushed 0.6.6 out to GitHub. It may take a little bit before a docker image is created for it.

mark-in-dallas commented 3 years ago

Worked for me too. Thanks so much guys!

drewwats commented 3 years ago

Hello all. I. just pushed 0.6.6 out to GitHub. It may take a little bit before a docker image is created for it.

Awesome, this worked! Much appreciated!

`

loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login',

    #                                  ('{"username":"' + username + '","password":"' + password + '"}').encode("utf-8"),
    #                                  {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT})

    loginReq = urllib.request.Request('https://api.locastnet.org/api/user/login?client_id=CqhAMsBw%2BnxTXSJMLGqyOw%3D%3D',
                                      ('{"username":"' + username + '","password":"' + password + '","captcha":"locast2plex"}').encode("utf-8"),
                                      {'Content-Type': 'application/json', 'User-agent': self.DEFAULT_USER_AGENT})`
patrick-GH commented 3 years ago

how long does it take for docker hub to get updated?

tgorgdotcom commented 3 years ago

Hmm. It seems that automated builds were disabled on my docker account - moved behind the pro plan. Sending a request to get it reenabled, since it's an open source project. Meanwhile I'll see if I can manually push an image to docker.

Nbr1Sniper commented 3 years ago

Docker vs windows python script; any advantage or disadvantage? I can run docker in my home assistant instance but figure my pc processor would be better to use over a VM of home assistant. Thoughts?

mlweber62 commented 3 years ago

The solution provided worked for a day, but is no longer working for me, and I'm getting the login error again.

seantdavidson commented 3 years ago

I have upgraded to the new docker version and I am still getting the error

Logging into Locast using username emailaddress@email.com... Error in function login: Forbidden Invalid Locast Login Credentials. Exiting...

drewwats commented 3 years ago

I have upgraded to the new docker version and I am still getting the error

Logging into Locast using username emailaddress@email.com... Error in function login: Forbidden Invalid Locast Login Credentials. Exiting...

The Docker image for locast2plex has not been updated yet. You can manually modify the .py file as described above as a temporary fix.

https://hub.docker.com/r/tgorg/locast2plex

LLCoolWas commented 3 years ago

Ok I finally got time to take another look at this and realized what I was doing wrong. I edited the file on my C: drive where locast2plex's files were, but did not copy it to the container. To do so I had to open a command prompt and run the docker command above (and get my container name right... image docker cp locast_service.py locast2plex-main_locast2plex_1:/app/lib/locast_service.py

Thanks everyone

tgorgdotcom commented 3 years ago

Hello all. Docker image is pushed live now. Let me know if you're still running into any issues. I've also sent along a request to locast to see if we can find a more official way to login.

drewwats commented 3 years ago

Hello all. Docker image is pushed live now. Let me know if you're still running into any issues. I've also sent along a request to locast to see if we can find a more official way to login.

Image pulled and started up without issue. Thank you!

seantdavidson commented 3 years ago

Hello all. Docker image is pushed live now. Let me know if you're still running into any issues. I've also sent along a request to locast to see if we can find a more official way to login.

Thanks for all involved, just pulled the newest docker container and I am back up and running.

ljo123 commented 3 years ago

Still getting the same issue today after upgrading to the newest version of locast2plex. I checked locast_service.py and it has the "captcha":"locast2plex" in there correctly. Not sure what the issue is.

Creating locast2plex-066_locast2plex_1 ... done
Attaching to locast2plex-066_locast2plex_1
locast2plex_1  | Locast2Plex v0.5.3
locast2plex_1  | Tuner count set to 3
locast2plex_1  | UUID set to: xxx...
locast2plex_1  | Logging into Locast using username xxx@xxx.com...
locast2plex_1  | Error in function login: Forbidden
locast2plex_1  | Exiting...

Never mind. It was stuck using an old image. Working now thanks!

zatmonkey commented 3 years ago

Still having the issue today :( Pulled in a clean image so that's not that and it was working before image

KBoz commented 3 years ago

I tried rebuilding the docker with the latest version 0.6.6 using the docker run -v with tgorg/locast2plex at the end. For some reason it picked up 0.6.5 instead of the latest on the GitHub. Version 0.6.5 immediately failed on the login.

Also I'm not sure what version I ws currently runnign anyway. The only files I can find on my QNAP is a locast2plex-0.5.3 under home on DataVol1

Screenshot (12)

LSparks608 commented 3 years ago

Same, cant connect with new version v0.6.6

Error in function login: Not Found Invalid Locast Login Credentials. Exiting...

enz1ey commented 3 years ago

I am also unable to log in, I'm getting this:

Error in function login: Expecting value: line 1 column 1 (char 0)

craigarno commented 3 years ago

Seattle WA area, problem described here started Friday 20-Aug-2021 Added code from the login line above (both "clientID" and "captcha" parts) and Locast2Plex-0.6.5 is working again. Thank you all for finding a fix.

scrawfor commented 3 years ago

The docker image does seem stale. I built it locally and it works fine

services:
  locast2plex:
    image: tgorg/locast2plex
    build:
      context: ./
      # dockerfile: ./Dockerfile
    ports:
      - "6077:6077"
      - "1900:1900/udp"
    restart: unless-stopped
    volumes:
      - ./config.ini:/app/config/config.ini
mikedizzle commented 3 years ago

Thanks for all who commented in this issue!

cklinker commented 3 years ago

Register the app at https://www.locast.org/developers/apply to get a valid client id and the captcha issues will go away