Authentication

Your app already knows who the user is. The mini-app turns that identity into a TrueVisions entitlement through the TrueID Account Wise (AAA) binding flow. From the host's side it is one POST: open the WebView on the landing endpoint with your access token and let the redirects run.

How it works

  1. Your app opens the WebView with POST /[lang]/[partner]/auth/landing and your user's access token in the body.
  2. The mini-app server asks AAA for an authorization code for that token (PKCE, signed state, ten-minute validity).
  3. If the user is already bound to TrueID, AAA returns a code, the server exchanges it and redirects to the partner home with a TrueVisions access token in the URL fragment. The viewer is signed in.
  4. If the user must bind first, the WebView is redirected to the AAA binding page (sdk-identity.trueid.net). When it completes, AAA sends the WebView back to the mini-app's callback, which finishes the exchange and lands on the partner home.
  5. Anything else redirects to a localised error page (/auth/error?code=…).

Account Wise flow

The full picture behind the landing POST: which host sends what, the AAA binding and exchange round trips, and what reaches the browser.

Account Wise sign-in: host apps POST to their landing endpoint (the design also has TrueApp's token come from the TrueApp Service, not called yet); the mini-app runs the AAA binding sub-routine, exchanges the auth code for an access token and hands only that token to the client. TrueID skips binding with a bridged token.TVS mini-app (web + SSR)TrueID AAABinding processExchange processTrueApp Service(1) guest token (client_id + secret, device, session-id)(2) guest access token(3) access token (authorization, guest token, device, session)(4) access tokenHost appsTrueAppTrueApplanding endpointTMN AppTMNlanding endpoint7Eleven App7Elevenlanding endpointTrueID AppTrueIDlanding endpointPOST, headers:trueapp-authorizationtrueapp-device-idtrueapp-session-idPOST, headertmn-access-tokenPOSTPOST (Authorization)bridged TID tokenpartnertokenBindingsub-routineBinding Service(1) get binding state(2) responseuserknown?Binding WebPageNo: (3) submit formYesauth_code(4) bound: redirect with auth_codeerror(4.2) error_codeget token (auth_code + PKCE verifier)Exchange Endpointaccess_tokenonlyClient sidememory + sessionStoragebridged token
Account Wise flow. Red boxes run at TrueID AAA; everything in the green lane is this mini-app. TrueID skips binding and exchange. Dashed: TrueApp Service calls from the design that this deployment does not make yet.
  1. Landing. Each host POSTs to its own landing endpoint (/[lang]/[partner]/auth/landing). A per-partner adapter reads the credential (table below). A viewer with no partner token enters at /auth/start instead: they log in on the TrueID login page, which returns an auth_code to the same callback (step 4).
  2. Binding state.The server calls AAA's request-code API with the partner token, a PKCE challenge and a signed state. A code back means the user is already known.
  3. Not known. AAA answers 14300, 14272 or 14222; the WebView is sent to the AAA binding page (a redirect, or a self-submitting form when AAA wants a POST).
  4. Bound. The binding page redirects to /auth/[partner]/callback with auth_code and the same state; on failure it redirects with error_code and the viewer lands on the error page.
  5. Exchange.The server trades the code plus the PKCE verifier for an access token at AAA's exchange endpoint.
  6. Client side.Only the access token reaches the browser, in the URL fragment. The design's "maintain token's session" is the WebView's memory plus sessionStorage; there is no server session.
HostSendsPath
TrueApptrueapp-authorization (or partner_token / bearer), trueapp-device-id, trueapp-session-idBinding + exchange
TMNtmn-access-tokenBinding + exchange
7ElevenToken in the body (access_token, field name to be confirmed)Binding + exchange
TrueIDAuthorization: Bearer bridged TID tokenStraight to the client, no AAA

The landing request

Send a POST with application/x-www-form-urlencoded or application/json. The response is a redirect chain; the WebView follows it.

HTTPHTTP
POST https://mini-app.truevisions.co.th/th/trueapp/auth/landing
Content-Type: application/x-www-form-urlencoded

partner_token=eyJhbGciOi…&device_id=8f1c…&session_id=4b2e…&platform=ANDROID&version=9.12.0&device_model=Pixel%208
FieldRequiredMeaning
partner_tokenyesYour app's access token for the user (the JWT AAA verifies). Also accepted: auth_token, access_token, an Authorization: Bearer header, x-partner-token. Any of these can also be a query param.
device_idrecommendedStable device identifier your app already reports to TrueID.
session_idrecommendedYour app session id. A UUID is generated when omitted.
platformyesiOS or ANDROID. Selects the AAA client id and partner code.
versionrecommendedYour app version, e.g. 9.12.0.
device_modeloptionalDevice model string. Derived from the user agent when omitted.

The lang segment (th / en) picks the language of every page that follows, including the error page. TrueID users (partner = trueid) pass a bridged token the same way and skip AAA entirely.

What the WebView will see

OutcomeResponse
Signed in303 to /[lang]/[partner]#at=…&exp=…, then the partner home renders signed in.
Binding required303 to the AAA binding page, or a self-submitting HTML form when AAA wants a POST. The binding page later redirects to /auth/[partner]/callback?code=…&state=…, which lands on the partner home like above.
Failure303 to /[lang]/[partner]/auth/error?code=….

Error codes: missing_credentials, unknown_partner, invalid_state, trueapp_token, request_code, exchange, and aaa_<code>for AAA's own numeric codes.

Knowing whether the viewer is signed in

After every page load inside a WebView the mini-app posts an auth-state message. Use it to decide whether to show your own subscribe entry points or to retry the landing POST when a token has expired.

Bridge messageJSON
{ "channel": "truevision-app", "type": "auth-state", "state": "signed-in" }
{ "channel": "truevision-app", "type": "auth-state", "state": "signed-out" }
  • The token lives in the WebView's sessionStorage. Destroying the WebView signs the viewer out; re-open it with the landing POST.
  • Opening a browse URL directly with loadUrl keeps an existing session in the same WebView.
  • Every page needs a signed-in viewer. Signed out (or with an expired token) the page starts TrueID sign-in itself (/auth/start); if the player's token is rejected mid-session it posts sign-in. See Player.

Domains the WebView must reach

DomainPurpose
mini-app.truevisions.co.thThe mini-app itself.
sdk-identity.trueid.netAAA binding page (pre-production: sdk-identity.trueid-preprod.net).
identity.trueid.netTrueID login page for viewers without a partner token (pre-production: identity.trueid-preprod.net).
*.dmpcdn.comArtwork and feeds.
tvs-streamer.trueid.netStream lookup, called from the page (pre-production: tvs-streamer.trueid-preprod.net).
Stream and licence hostsReturned by the stream lookup; provided at onboarding.

Testing

Non-production deployments include a mock AAA and a mock host page for the partner-token path. The no-token path always uses the real TrueID login page, which only accepts the callback URL registered with AAA, so test it on a deployed environment, not on localhost. Open https://mini-app.truevisions.co.th/api/mock/host?lang=en&partner=trueapp in a browser, pick a scenario and submit: bound signs straight in, unbound runs the binding page round trip, expired shows the error page. Point your WebView at the same URL to exercise your bridge and redirect handling end to end.