PlexJwt class final Client and sign-in
A token plex.tv issued, with what its claims say about its lifetime.
A JWT from plex.tv lasts 7 days and can be refreshed at any time, also
after it has expired (PlexAccountApi.refreshJwt). A legacy token is
not a JWT: PlexJwt.parse still accepts it, with no expiry (expiresAt is
null), so code that handles both does not branch.
The claims are read, not verified: the token came from plex.tv over HTTPS, and it is plex.tv and the servers that check it.
Constructors
- PlexJwt.parse(String token)
-
Reads
token's payload. A token that is not a three-part JWT, or whose payload is not JSON, is kept with no claims.factory
Properties
-
claims
→ Map<
String, Object?> -
The decoded payload; empty for a token that is not a JWT.
final
- expiresAt → DateTime?
-
When the token expires (
exp), ornullwhen it does not say.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- isJwt → bool
-
Whether token is a JWT with claims (a legacy token is not).
no setter
- issuedAt → DateTime?
-
When it was issued (
iat).no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- thumbprint → String?
-
The thumbprint of the device key the token is bound to
(
thumbprint), when plex.tv put one in.no setter - token → String
-
The token, to send as
X-Plex-Token.final
Methods
-
expiresWithin(
Duration margin, [DateTime? now]) → bool -
Whether the token expires within
marginofnow.falsefor a token with no expiry. -
isExpired(
[DateTime? now]) → bool -
Whether expiresAt has passed (compared with
now, or the clock). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited