Plex Binding - "Unable to fetch API, token may be wrong?"

Hey Folks,

I’ve got a test instance of OH 4.1.2 up and running and am experimenting with the Plex binding for the first time.

I generated a token for authentication and have validated my token is correct via a curl command (token and personal details randomised in snippet below):

curl -X GET "https://plex.tv/api/v2/user" \
  -H "Accept: application/json" \
  -H "X-Plex-Token: abctoken1234567890123""
{"id":00003140,"uuid":"61f1b7cc2a81ab49","username":"<user>","title":"<user>","email":"my@email","friendlyName":"","locale":null,"confirmed":true,"joinedAt":1585272761,"emailOnlyAuth":false,"hasPassword":true,"protected":false,"thumb":"https://plex.tv/users/61f1b7cc2a81ab49/avatar?c=1717026117","authToken":"abctoken1234567890123","mailingListStatus":"active","mailingListActive":true,"scrobbleTypes":"","country":"AU","subscription":.......

All looks good so far - except that I get this when setting up a server Thing:
CONFIGURATION_ERROR

Unable to fetch API, token may be wrong?

I turned on tracing for the Plex binding (side note: thanks to whoever added this easy switching of log levels to the UI, I love it!)

The output is here (again, token and external IP obliterated):

2024-05-30 09:42:53.488 [DEBUG] [x.internal.handler.PlexServerHandler] - Initializing server handler
2024-05-30 09:42:53.537 [DEBUG] [x.internal.handler.PlexServerHandler] - Fetch API with config, org.openhab.binding.plex.internal.config.PlexServerConfiguration@4d6244c5
2024-05-30 09:42:53.920 [DEBUG] [ex.internal.handler.PlexApiConnector] - HTTP response: <?xml version="1.0" encoding="UTF-8"?>
<MediaContainer size="2">
  <Device name="hgnas" product="Plex Media Server" productVersion="1.29.2.6364-6d72b0cf6" platform="Linux" platformVersion="DSM 7.0.1.42218-0" device="DS220+" clientIdentifier="9edee779d49229d7b63dc2cf90802180fd882a1c" createdAt="1646272314" lastSeenAt="1716944225" provides="server" owned="1" accessToken="abctoken1234567890123" publicAddress="255.128.255.128" httpsRequired="0" synced="0" relay="1" dnsRebindingProtection="0" natLoopbackSupported="0" publicAddressMatches="1" presence="1">
    <Connection protocol="https" address="10.0.4.12" port="32400" uri="https://10-0-4-12.9a386df0878c49a0b352b5b774791689.plex.direct:32400" local="1"/>
    <Connection protocol="https" address="255.128.255.128" port="14644" uri="https://255-128-255-128.9a386df0878c49a0b352b5b774791689.plex.direct:14644" local="0"/>
  </Device>
  <Device name="TV 2023" product="Plex for Samsung" productVersion="5.82.2" platform="Tizen" platformVersion="7" device="23_NIKEL_UHD" clientIdentifier="da4nw6kkctizttsyu09n9el9" createdAt="1695962991" lastSeenAt="1716970985" provides="client,player" owned="1" publicAddress="255.128.255.128" publicAddressMatches="1" presence="0" accessToken="abctoken1234567890123">
    <Connection protocol="https" address="10.0.4.12" port="32400" uri="https://10-0-4-12.9a386df0878c49a0b352b5b774791689.plex.direct:32400" local="1"/>
    <Connection protocol="https" address="255.128.255.128" port="14644" uri="https://255-128-255-128.9a386df0878c49a0b352b5b774791689.plex.direct:14644" local="0"/>
  </Device>
</MediaContainer>

2024-05-30 09:42:53.925 [DEBUG] [ex.internal.handler.PlexApiConnector] - MediaContainer 2

Again, looks fine - it correctly identifies the Plex server and one of the players. I take from that that the token is validating fine.

My guess is that there might be an item in my Plex config that’s resulting in unexpected / incomplete data being sent back to the binding, and from there the Thing fails to initialise.

I’ve checked the binding config and the community here - happy to be pointed to something I’ve missed, equally happy to try any new tips!

Cheers,
Matt

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.