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

"Refreshed the access token expiry" is confusing. #123

Closed
glensc opened this issue Apr 7, 2024 · 2 comments · Fixed by #125
Closed

"Refreshed the access token expiry" is confusing. #123

glensc opened this issue Apr 7, 2024 · 2 comments · Fixed by #125

Comments

@glensc
Copy link
Collaborator

glensc commented Apr 7, 2024

First I thought the message was fetching refresh token for the plex token, and that got me thinking, where does it store the refresh token, in memory? didn't see anything in the disk.

But looking at the source, it just sends a test request (aka ping) and does nothing with the result?:

  • protected def ping(client: HttpClient)(config: PlexConfiguration): IO[Unit] = {
    config.plexTokens.map { token =>
    val url = Uri
    .unsafeFromString("https://plex.tv/api/v2/ping")
    .withQueryParam("X-Plex-Token", token)
    .withQueryParam("X-Plex-Client-Identifier", "watchlistarr")
    client.httpRequest(Method.GET, url).map {
    case Right(_) =>
    logger.info(s"Refreshed the access token expiry")
    case Left(err) =>
    logger.warn(s"Unable to ping plex.tv: $err")
    }
    }
    }.toList.sequence.map(_ => ())
@nylonee
Copy link
Owner

nylonee commented Apr 8, 2024

Ah yeah, this confused me as well, it turns out that Plex handles 'token refresh' in a different way

It looks like when the token is validated on the Plex size, it's also "renewed" in their backend. If the token were a JWT, it would have a claims set that would have a fixed expiry date, but because it's not a JWT, I guess Plex just decides they can do whatever they want with their token.

Pinging the Plex token regularly ensures that it does not get invalidated on the Plex backend.

We only have empirical evidence to support this - I've been running the same token on my server for 6 months and it hasn't expired, so that's a big step up from the previous expiry times (1-2 months on Overseer)

@glensc
Copy link
Collaborator Author

glensc commented Apr 8, 2024

maybe change "Refreshed the access token expiry" to "Pinged Plex API Server to update access token expiry"

but closing, as it's not a "wrong" message.

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

Successfully merging a pull request may close this issue.

2 participants