Skip to Content
Xeonr Developer Docs

Authentication

The credentials the XMB API accepts, the scopes each method needs, who may call the machine-only methods, and what a refusal looks like.

The XMB API is the xmb.api.v1 package, served over Connect at https://xmb.gg/xmb.api.v1.<Service>/<Method>, so each method is a POST with a JSON or protobuf body. The API reference lists every method, request and response.

Sending a token

Send a Xeonr Auth access token on every call as Authorization: Bearer <token>. Nothing else authenticates a call: no ?token= parameter, no other scheme (an OAuth <token> header is refused), and no cookie. The one cookie the API sets, a browser's refresh token (see Signing in), is read only by AuthService.RefreshToken.

A token is accepted only when it:

  • was issued by Xeonr Auth for this environment (https://auth.xeonr.io);
  • carries XMB's audience (https://xmb.gg, or XMB's urn:xeonr:auth:application:…). A token minted for another product is refused even when the same person holds it;
  • carries an exp. A token without one, such as a service account's raw assertion, is refused: exchange it (jwt-bearer) for an access token first.

A call without a token, or with one that does not verify, answers unauthenticated. A token that verifies but lacks what the method needs answers permission_denied.

Scopes

Every method names the scopes it requires in its options, and the reference shows them under Required scopes. A token must carry all of them.

ScopeLets the token
xmb:user:readRead the caller's own account and what they may watch
xmb:user:writeChange the caller's own state: watch history, My List, downloads, preferences
xmb:adminReach the server-administration methods at all. Which server the caller may administer is still their role on it
xmb:super:adminPlatform operations across every server. Granted only to platform operators
xmb:privateFirst-party surfaces
xmb:internal:routingThe gateways' routing table. Service accounts only
xmb:internal:profilesBuild a named person's profile page. The Profiles service account only

The scope is the first gate, never the last: an administrator method also checks that the caller administers the server it names, asked of Xeonr Auth for the server's team. A caller with no role on the server gets not_found; a member who is not an administrator gets permission_denied.

Server membership

A server's people are a Xeonr Auth team, and every membership and role decision asks Xeonr Auth, never the teams list inside the token. When Xeonr Auth cannot be reached the call answers unavailable — retry it. When your token predates a change to your teams (you were removed from one, or lost a role), the call answers unauthenticated: refresh the token and retry.

Service accounts

A service account's (or client's) token is refused on every method except the few that admit machines, and those refuse a person's token:

MethodCaller
RoutingService.GetRoutingTable, RoutingService.ReportPeerStatusThe WireGuard gateways, holding xmb:internal:routing
xeonr.profileprovider.v2.ProfileProviderService.*The Profiles service, holding xmb:internal:profiles

A product acting for a person with a delegated token can reach only the profile-provider methods.

Signing in

XMB's apps sign in with the authorization code flow and PKCE (S256), brokered by the API so its client secret never reaches a device:

  1. AuthService.GetAuthorizationUrl returns Xeonr Auth's authorization URL. The API generates the PKCE verifier, keeps it server-side against the state, and puts only the S256 challenge in the URL.
  2. Send the person to that URL. Xeonr Auth redirects back with code and state in the query (never the fragment).
  3. AuthService.HandleLogin with that code and state redeems the code with the stored verifier and returns the access token.

How the refresh token travels depends on the client:

  • Browsers set session_cookie: true on HandleLogin. The API leaves the refresh token out of the response and sets it as an httpOnly, Secure, SameSite=Strict cookie scoped to the AuthService path, so page script can never read it. Keep the access token in memory only. To refresh, call RefreshToken with an empty refresh_token: the API reads the cookie, rotates it and returns a new access token. AuthService.EndSession clears the cookie when the person signs out (it is idempotent).
  • Native apps leave session_cookie false, get the refresh token in the response, and keep it in the platform keychain.

Methods without a token

These take no bearer: the sign-in steps (AuthService.GetAuthorizationUrl, HandleLogin, RefreshToken, EndSession), the hub, grabber and tuner agent methods (which authenticate with the node's own token in the request), a receiver before it is claimed (RemotePlaybackService.AttachUnclaimedReceiver, AwaitClaim), and TelemetryService.MintTelemetryToken, which works signed out and, when a token is sent, still verifies it.

Refreshing a session

AuthService.RefreshToken exchanges a refresh token (sent in the request, or a browser's session cookie when the request's is empty) for a new pair. Xeonr Auth rotates the refresh token on every use, so keep only the newest one. Concurrent refreshes of the same token (two tabs, a phone and a television) share one exchange and get the same new pair. The answer tells you what to do next:

AnswerMeaning
A new pairReplace both tokens
unauthenticatedThe refresh token is spent, revoked or expired, and a browser's cookie has been cleared. Sign in again
unavailableXeonr Auth could not be reached. Keep your refresh token and retry

Audit

Every call that changes something is recorded in the platform audit log as the calling subject (and, for a delegated token, the product acting for them). Background work, such as a library scan or the Trakt sync, is recorded as the system.

On this page