chrisbenincasa / tunarr

Spiritual successor to dizqueTV
https://tunarr.com/
zlib License
84 stars 9 forks source link

[Bug]: Connect Plex Loops After SSO #598

Open ThisGuyNeedsABeer opened 3 days ago

ThisGuyNeedsABeer commented 3 days ago

Contact Details

Via GitHub Please

What happened?

Attempting to connect Plex, I get through the SSO stage, and Plex never links. Using the latest Docker build running via Unraid. My Plex instance and Tunarr are on the same VLAN, Plex is accessible from the web and locally.

Tried 3 browsers, Chrome, Edge, FireFox. I got a "New login to your plex account" alert, but the server does not appear in the list.

Happy to provide any logs that may assist.

Version

https://github.com/chrisbenincasa/tunarr/pkgs/container/tunarr (latest)

What browser did you experience the the problem on?

Chrome (125.0.6422.142 (Official Build) (64-bit)), FF (127.0.2 (64-bit)), and MS Edge

What operating system are you using?

Windows 11 / macOS Sonoma 14.5

Relevant log output

No logs, just a loop
chrisbenincasa commented 3 days ago

Thanks for the report. Can you see if there is anything in the browser console logs?

On Sat, Jun 29, 2024 at 3:04 AM ThisGuyNeedsABeer @.***> wrote:

Assigned #598 https://github.com/chrisbenincasa/tunarr/issues/598 to @chrisbenincasa https://github.com/chrisbenincasa.

— Reply to this email directly, view it on GitHub https://github.com/chrisbenincasa/tunarr/issues/598#event-13338560247, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMQRX5JVKHVSYHVMZTC4WDZJZL7ZAVCNFSM6AAAAABKC6WNBKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJTGMZTQNJWGAZDINY . You are receiving this because you were assigned.Message ID: @.***>

ThisGuyNeedsABeer commented 3 days ago
        "env": {},
        "headers": {
          "Accept": "application/json",
          "X-Plex-Device": "Tunarr",
          "X-Plex-Device-Name": "Tunarr",
          "X-Plex-Product": "Tunarr",
          "X-Plex-Version": "0.1",
          "X-Plex-Client-Identifier": "[REDACTED]",
          "X-Plex-Platform": "Chrome",
          "X-Plex-Platform-Version": "80.0",
          "X-Plex-Token": "[REDCATED]",
          "User-Agent": "axios/1.6.0",
          "Accept-Encoding": "gzip, compress, deflate, br"
        },
**** NOT MY IP OR EVEN CLOSE ****
        "baseURL": "https://192-168-0-125.c20c3fbb7bde427290757d0a83d3d488.plex.direct:32400",
        "method": "get",
        "url": "/",
        "metadata": {
          "startTime": 1719644729321
        }
      },
      "code": "ETIMEDOUT",
      "status": null
    }
**** NOT MY IP OR EVEN CLOSE ****
2024-06-29T07:08:40.605Z [error]: Plex request error: connect ETIMEDOUT 172.31.200.1:32400 
    err: {
      "message": "connect ETIMEDOUT 172.31.200.1:32400: connect ETIMEDOUT 172.31.200.1:32400",
      "name": "Error",
      "stack":
          Error: connect ETIMEDOUT 172.31.200.1:32400
              at AxiosError.from (file:///tunarr/server/build/bundle.js:241576:14)
              at RedirectableRequest.handleRequestError (file:///tunarr/server/build/bundle.js:243323:34)
              at RedirectableRequest.emit (node:events:519:28)
              at eventHandlers.<computed> (file:///tunarr/server/build/bundle.js:121942:28)
              at ClientRequest.emit (node:events:519:28)
              at TLSSocket.socketErrorListener (node:_http_client:500:9)
              at TLSSocket.emit (node:events:519:28)
              at emitErrorNT (node:internal/streams/destroy:169:8)
              at emitErrorCloseNT (node:internal/streams/destroy:128:3)
              at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
          caused by: Error: connect ETIMEDOUT 172.31.200.1:32400
              at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1606:16)
              at TCPConnectWrap.callbackTrampoline (node:internal/async_hooks:130:17)
      "config": {
        "transitional": {
          "silentJSONParsing": true,
          "forcedJSONParsing": true,
          "clarifyTimeoutError": false
        },
        "adapter": [
          "xhr",
          "http"
        ],
        "transformRequest": [
          null
        ],
        "transformResponse": [
          null
        ],
        "timeout": 0,
        "xsrfCookieName": "XSRF-TOKEN",
        "xsrfHeaderName": "X-XSRF-TOKEN",
        "maxContentLength": -1,
        "maxBodyLength": -1,
        "env": {},
        "headers": {
          "Accept": "application/json",
          "X-Plex-Device": "Tunarr",
          "X-Plex-Device-Name": "Tunarr",
          "X-Plex-Product": "Tunarr",
          "X-Plex-Version": "0.1",
          "X-Plex-Client-Identifier": "[REDACTED]",
          "X-Plex-Platform": "Chrome",
          "X-Plex-Platform-Version": "80.0",
          "X-Plex-Token": "[REDACTED]",
          "User-Agent": "axios/1.6.0",
          "Accept-Encoding": "gzip, compress, deflate, br"
        },
        "baseURL": "https://172-31-200-1.c20c3fbb7bde427290757d0a83d3d488.plex.direct:32400",
        "method": "get",
        "url": "/",
        "metadata": {
          "startTime": 1719644789327
        }
      },
      "code": "ETIMEDOUT",
      "status": null
    }
2024-06-29T08:00:04.386Z [info]: XMLTV Updated at 6/29/2024, 4:00:03 AM {"task":"update-xmltv"}
2024-06-29T12:00:00.304Z [info]: XMLTV Updated at 6/29/2024, 8:00:00 AM {"task":"update-xmltv"}

 _____ _   _ _  _   _   ___ ___ 
|_   _| | | | \| | /_\ | _ \ _ \
  | | | |_| | .` |/ _ \|   /   /
  |_|  \___/|_|\_/_/ \_\_|_\_|_\

                0.1.0

2024-06-29T15:43:24.423Z [info]: Searching for legacy dizquetv directory at /.dizquetv
/tunarr/server/build/.tunarr/stream-cache.json null
2024-06-29T15:43:25.781Z [info]: XMLTV Updated at 6/29/2024, 11:43:25 AM {"task":"update-xmltv"}
2024-06-29T15:43:25.812Z [info]: HTTP server running on port: http://0.0.0.0:8000
2024-06-29T15:43:32.627Z [info]: Open event channel.
2024-06-29T15:44:29.939Z [info]: Open event channel.
Momar8989 commented 2 days ago

I'm having the same issue. Just installed new on Unraid. Click, connect to plex, sign in, then the window closes. Return to Tunarr and it still says "Connect to Plex". Tried a few times all on chrome.

ThisGuyNeedsABeer commented 2 days ago

Watching my logs, it's showing Tunarr trying to connect to varions LAN IP addresses outside of my subnet with claim tokens in plaintext.

chrisbenincasa commented 2 days ago

I can look into this more next week, I'm away right now.

Tunarr hits the Plex "devices" endpoint after authenticating and attempts to find successful connections for any device that has the "server" capability.

chrisbenincasa commented 2 days ago

The code is here: https://github.com/chrisbenincasa/tunarr/blob/dev/web/src/helpers/plexLogin.ts

All of these connections should be using HTTPS so the token exchange in plaintext should not be a worry