Documentation Index
Fetch the complete documentation index at: https://mintlify.com/faraasaaay/inner/llms.txt
Use this file to discover all available pages before exploring further.
PlaybackAuthState is the central authentication state container for Inner. It holds all credential and token data and is passed through the request pipeline to produce properly authenticated HTTP headers. Both the YouTube singleton (via YouTube.authState) and PortableInnertube (via applyAuthState()) use this type to manage auth context.
PlaybackAuthState fields
The raw YouTube Music cookie header string, for example
"SAPISID=xxx; HSID=yyy; SSID=zzz; ...". The presence of a SAPISID key in this value determines whether hasLoginCookie returns true. Whitespace is trimmed and empty strings are converted to null during normalization.The visitor identifier associated with the current session, typically starting with
"Cgt" or "Cgs". This value is sent as part of the client context in every InnerTube request and is used as the sessionId when no login cookie is present.The account identifier sent as
onBehalfOfUser in authenticated browse and playback requests. Populated from the user’s account session after login. Values containing the || separator are automatically resolved during normalization — see Normalization below.A generic PoToken fallback. Used by both
resolvePlayerPoToken() and resolveGvsPoToken() when their respective dedicated tokens (poTokenPlayer and poTokenGvs) are not set.A PoToken specifically for signing GVS (Google Video Server) stream URLs. When
webClientPoTokenEnabled is true and the requesting client requires service integrity, this token is included in stream URL parameters. Falls back to poToken if null.A PoToken for the player’s
serviceIntegrityDimensions field. Required by web-family clients (WEB, WEB_REMIX, MWEB, etc.) for playback requests. Falls back to poToken if null.Master gate for all PoToken resolution. When
false, both resolvePlayerPoToken() and resolveGvsPoToken() return null regardless of other token fields. Set to true when you have valid PoTokens and want them to be included in requests.Computed properties
true if cookie is non-null and its parsed key-value map contains the key "SAPISID". This is the primary indicator that the user is authenticated.true if hasLoginCookie is true and dataSyncId is not null or blank. When both conditions are met, the full login context (cookie + account ID) is available for authenticated playback.Returns
dataSyncId when hasPlaybackLoginContext is true; otherwise returns visitorData. This is the identifier used as the active session context in requests.A SHA-1 hash of all state fields joined with null bytes. The fingerprint changes whenever any credential field changes, making it suitable as a cache key for auth-dependent data (visitor data, stream URLs, etc.).Fields included in the hash (in order):
cookie, visitorData, dataSyncId, poToken, poTokenGvs, poTokenPlayer, webClientPoTokenEnabled.Normalization
normalized() returns a new PlaybackAuthState with all string fields sanitized:
- Whitespace trimming — leading and trailing whitespace is stripped from every string field.
- Empty string to null — any field that is empty or equal to the literal string
"null"(case-insensitive) is converted tonull. dataSyncIdseparator resolution — whendataSyncIdcontains the||separator, the value is resolved as follows:- If the value ends with
||(e.g."abc123||"), the portion before||is used. - Otherwise, the portion after
||is used (e.g."||abc123"→"abc123").
- If the value ends with
normalized() is called automatically whenever you set individual properties on PortableInnertube (e.g. client.visitorData = "...") or call applyAuthState(). You should also call it manually if you construct a PlaybackAuthState from raw user input.
Token resolution methods
resolvePlayerPoToken
serviceIntegrityDimensions. Resolution priority:
explicitPoToken(if non-null and non-empty after normalization)poTokenPlayer(ifwebClientPoTokenEnabledistrueand the client requires service integrity)poToken(fallback, same conditions)null— ifwebClientPoTokenEnabledisfalseor the client does not need service integrity
resolveGvsPoToken
client is provided and does not require service integrity, returns null. Otherwise resolution priority:
poTokenGvs(ifwebClientPoTokenEnabledistrue)poToken(fallback, same condition)null
WEB, WEB_REMIX, WEB_CREATOR, MWEB, WEB_EMBEDDED_PLAYER, TVHTML5, TVHTML5_SIMPLY_EMBEDDED_PLAYER, TVHTML5_SIMPLY.
PlaybackAuthState.EMPTY
The default unauthenticated state. All fields arenull and webClientPoTokenEnabled is false.
PlaybackAuthState.EMPTY as a safe starting point or to reset auth state.
PoTokenGenerator
PoTokenGenerator is a pure Kotlin object that produces deterministic proof-of-origin tokens from a visitor identifier and client-state string. It does not require a WebView or BotGuard execution — tokens are generated locally using XOR encryption, varint encoding, and URL-safe Base64.
generateColdStartToken
identifier (typically visitorData or dataSyncId) and an optional clientState string. Each call generates a fresh token with a new random 16-byte key, so repeated calls produce different tokens.
The session identifier to embed in the token — typically
visitorData.An optional state string that qualifies the token context. Pass
"session" for session tokens or a videoId for content-specific tokens.String — a URL-safe Base64-encoded token (without padding = characters).
generateSessionToken
generateColdStartToken(identifier, clientState = "session"). Use this for poTokenPlayer — the token associated with the player session rather than a specific video.
generateContentToken
generateColdStartToken(identifier, clientState = videoId). Use this when you need a token scoped to a specific video, for example when pre-fetching stream URLs for a particular track.