Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failing to connect to Plex server. #16

Open
nx6 opened this issue Oct 5, 2024 · 17 comments
Open

Failing to connect to Plex server. #16

nx6 opened this issue Oct 5, 2024 · 17 comments

Comments

@nx6
Copy link

nx6 commented Oct 5, 2024

Not working for me. The app can find my Discord fine, and my Plex server, and I have it authorized, but it cannot connect to the Plex server.

"INFO: Testing R https://(plex.direct ip address, etc.)..."
"WARN: Timeout R https://(plex.direct ip address, etc.)..."

I'm not having any issues with remote access functionality on my server.

P.S.: can you put a button or menu command to access the log on the interface window? I can't hit F5 on the app window since that function is mapped to media keys on my keyboard, and even when I try FN+F5 it's not working for some reason. I have to use the on-screen keyboard to get the F5 key to pass through.

@nx6
Copy link
Author

nx6 commented Oct 25, 2024

Okay, making some progress now with 1.5.3. It's actually listing my server in the pop-up menu on the main window.
Getting new errors now.

[00:08:00] status/sessions?X-Plex-Token=[REDACTED]
[00:08:00] WARN: Unable to get current session: status/sessions?X-Plex-Token=2ys... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[00:08:05] status/sessions?X-Plex-Token=[REDACTED]
[00:08:05] WARN: Unable to get current session: status/sessions?X-Plex-Token=2ys... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[00:08:10] status/sessions?X-Plex-Token=[REDACTED]
[00:08:10] WARN: Unable to get current session: status/sessions?X-Plex-Token=2ys... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[00:08:15] status/sessions?X-Plex-Token=[REDACTED]
[00:08:15] WARN: Unable to get current session: status/sessions?X-Plex-Token=2ys... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[00:08:20] status/sessions?X-Plex-Token=[REDACTED]
[00:08:20] WARN: Unable to get current session: status/sessions?X-Plex-Token=2ys... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
[00:08:25] status/sessions?X-Plex-Token=[REDACTED]
[00:08:25] WARN: Unable to get current session: status/sessions?X-Plex-Token=2ys... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.

I tried deleting the auth token and reauthing the app to my account but no change.

@Dyvinia
Copy link
Owner

Dyvinia commented Oct 25, 2024

can you send me your config file, as well as a screenshot of the main window

@nx6
Copy link
Author

nx6 commented Oct 25, 2024

can you send me your config file, as well as a screenshot of the main window

--removed old attachment--

@Dyvinia
Copy link
Owner

Dyvinia commented Oct 26, 2024

image
is this supposed to be in the skipped?

@nx6
Copy link
Author

nx6 commented Oct 26, 2024

image is this supposed to be in the skipped?

I had it set to use local ip, and I guess that's not working for some reason.

@Dyvinia
Copy link
Owner

Dyvinia commented Oct 26, 2024

im not sure how the local stuff works tbh as it was @alyssadev who implemented that a while ago and I've never had to use it myself

@nx6
Copy link
Author

nx6 commented Oct 26, 2024

It was something I tried in the beginning when the app wasn't able to connect via the plex.direct address. It should just be getting ignored now since it failed to work (hence the 'skip' notation it added to the config file).

@Dyvinia
Copy link
Owner

Dyvinia commented Oct 26, 2024

does the latest version work?

@nx6
Copy link
Author

nx6 commented Oct 27, 2024

No change. Tried wiping out the PlexampRPC folder in %appdata% too, so it would be like a fresh install, and no change.

@PotionsYT
Copy link

Hi there. I had this issue. But somone said to enable the local ip. Try this.
image

@ThatsNotAName
Copy link

ThatsNotAName commented Jan 17, 2025

Seems like it will only work for me if I'm on the server's host account. When I swap to my second account (the one I mainly use for streaming) that is added to my plex home it fails to connect to the server same as the log file pasted above.

I found a stack overflow post discussing the general
An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.
problem

Here's another one

If you want to try to recreate this issue @Dyvinia , try seeing if you get the same issue when you make a second account, give it library access and sign in with it on both plexamp and plexampRPC. If the issue doesn't happen see if adding the second account to your plex home causes it on the second account.

Additionally it would be really nice if you could add a feature to reauthenticate/sign out. Having to delete the appdata files to change your account is super odd. I'll add that when I use my main account the app is awesome it's just that I don't use my main account for streaming so I can't really use the app until this is fixed unfortunately...

@ThatsNotAName
Copy link

ThatsNotAName commented Jan 17, 2025

After doing some more researching one thing I noticed is that following the link http://your.local.ip.address:32400/status/sessions?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx
and putting in the correct token that you get from viewing XML it works how it's meant to but if you put in the wrong/random token it returns the same 401 error that the log is saying.
Unable to access https://mypublicip/status/sessions?X-Plex-Token=token Response status code does not indicate success: 401 (Unauthorized).
[name

Seems to me like plexampRPC isn't going to work for any account that doesn't own the server. Because when you try to get your plex token the same way on an account that doesn't own the content there's no option to open XML.

Host account

Example

Account that was given library access

Example2

I think a solution for people who can access the host account would be to use the host account auth token and to watch the "<Track addedAt=" section of the xml file for a user id match with the current logged in user on plexamp or on plexampRPC idk. People not on the host user account can't see dashboard activity like the host can. What's happening is when you log in with an account that doesn't own the server you're basically just returning an xml to THAT account's server. In the case that you arent the owner of the server you are listening to I don't believe it's possible to get Now Playing info without access to that host token.

XML example

Example3

I could be way off base on this but hopefully I have the right idea. @nx6 could you confirm whether you own your server on the account you were having issues?

@nx6
Copy link
Author

nx6 commented Jan 17, 2025

It's my server and I'm using the admin account. Server is on the same network as my PC running Discord/plexampRPC, which is why I originally was trying to run this with the local IP connection.

@ThatsNotAName
Copy link

@nx6 Well that def complicates things then. If you visit http://your.local.ip.address:32400/status/sessions?X-Plex-Token=xxxxxxxxxxxxxxxxxxxx with your token grabbed from this guide while playing music on plex amp do you see the <Track addedAt= section that I mentioned in my last post?

@nx6
Copy link
Author

nx6 commented Jan 18, 2025

@ThatsNotAName
Actually was not able to test that at first, as I was getting a "connection was reset" error. Then found I was unable to access my server from the local LAN IP at all. Server was working fine for everything, though.

I had Network preferences set to "Secure Connections: Required" which keeps the internal web interface from working over HTTP, too. I didn't realize that as I never use it (I just access it from app.plex.tv for any admining tasks).
Anyway, after changing that setting I can confirm I am getting the TrackaddAt= info you mention.

Was going to try PlexampRPC again after that but it's crashing with an error so I'm going to wipe and reinstall it.

Edit: Okay. Reinstalled PlexampRPC and reauthed it to my account. Local connection test is saying "Success" and Remote is still timing out. Still getting same error as before as far as actually updating the status:

WARN: Unable to get current session: status/sessions?X-Plex-Token=Rke... An invalid request URI was provided. Either the request URI must be an absolute URI or BaseAddress must be set.

@nx6
Copy link
Author

nx6 commented Jan 18, 2025

Oookay. This is working now.
Since I have a local connection test passing, I went into the settings and actually checked the option to use the Local Address. It flipped over and now preview shows track info. Also can see it when I check myself on Discord.

I guess the issue here with the local connection method on the current PlexampRPC version is you have to have your server set to allow non-secure connections, but if you go back to the beginning of this issue it was trying to use the secure local access plex.direct IP then and it was failing on that connection check too.

Still don't know why the remote access option is timing out/not working. I use Plexamp remotely on my phone all the time, so my server is certainly reachable that way.

Edit: I'd rather not allow the server to accept non-secure connections, since it can present an opportunity for auth tokens to get snooped. But this is still useful progress. Just seems to be an issue with it working with secure connections of any sort (remote or local).

@ThatsNotAName
Copy link

ThatsNotAName commented Jan 18, 2025

I just spent the past 3 hours learning visual studio and how to rebuild the code so I could test my theory out. My first roadblock was that PlexampRPC has a nugat version dependency that I had to build myself because the author of said dependency hadn't uploaded it to nuget yet and that took me like 2 hours to figure out how to do. Then, in MainWindow.xaml.cs, I replaced both occurrences of {SelectedResource?.AccessToken} (line 154 & line 367) with my host account's token. After that I changed the line
return sessions?.FirstOrDefault(session => session.Type == "track" && session.User?.Name == App.Account?.Username);
to return sessions?.FirstOrDefault(session => session.Type == "track" && session.User?.Name == "Shayne");
and now it works as I would expect it to! :D
Since I have no idea how to do variables or anything like that it's not much of a solution for the project in general but it at least proves what I originally thought to be the issue with it not working for me. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants