TrueMoney (TMN) integration
Everything a TrueMoney (TMN) app needs to open the TrueVisions NOW mini-app signed in: which token to send, how to open any page with it, and what the viewer sees. Every page requires a signed-in viewer; there is no guest mode.
At a glance
| TrueMoney (TMN) | |
|---|---|
| Partner slug | tmn |
| Base URL | https://mini-app.truevisions.co.th/[th|en]/tmn |
| Credential | tmn-access-token (HTTP header) |
| Also accepted | partner_token (body), access_token (body) |
| Sign-in path | TrueID AAA: request code → binding page only if AAA asks → token exchange. |
| How to open a page | GET the page URL with the token headers (a POST works too). |
Step by step
- Set up the WebView. JavaScript, DOM storage, inline media playback, autoplay without a gesture and protected media. See Install in your app and DRM in WebViews.
- Pick the page the viewer should land on from Pages you can open, in
thoren, and add?embed=1. - Open it with the token. Load that URL with the
tmn-access-tokenheader and the device headers. Copy-paste code is in Examples. - Let the redirects run. The server asks AAA for a code and exchanges it; the WebView gets a
303back to the same page, signed in. If the viewer has never linked TrueID, AAA's binding page opens first (TrueID login + OTP), then returns to the same page. - Listen to the bridge.
ready,auth-state,open-content,close,orientation,subscribe,sign-in. See postMessage bridge. - Re-sign-in when asked. On
sign-in(the stream lookup rejected the token), open the message'sreturnUrlthe same way as step 3 with a fresh token. Sessions last about an hour; after that any page asks again. - Test on pre-production with your own test accounts before going live (see Testing).
Pages you can open
All of these accept the token the same way. mOdBP4KN5vd3 is a real series title on pre-production; use any content id from the feeds.
| Page | URL | What it shows |
|---|---|---|
| Partner home | /th/tmn?embed=1 | Landing page with the partner's shelves. |
| Sport | /th/tmn/sport?embed=1 | All live and upcoming sport, grouped by day. |
| Series | /th/tmn/series?embed=1 | All series and movies in the free catalogue. |
| The Voice 2026 | /th/tmn/thevoice?embed=1 | The Voice shelf page. |
| Content detail | /th/tmn/content/mOdBP4KN5vd3?embed=1 | One title: synopsis, episodes, Watch Now. |
| Player | /th/tmn/play/mOdBP4KN5vd3?embed=1 | Full-screen player; a series starts at episode 1. |
| Player, one episode | /th/tmn/play/mOdBP4KN5vd3?ep=<EPISODE_ID>&embed=1 | Jump to a specific episode. |
| Live channel | /th/tmn/watch/<CHANNEL_ID>?embed=1 | Live TV player for one channel. |
Examples
Raw requests for the four most common pages. The response is a redirect chain; let the WebView follow it.
GET https://mini-app.truevisions.co.th/th/tmn/series?embed=1
tmn-access-token: <TMN_ACCESS_TOKEN>
x-device-id: <DEVICE_ID>
x-session-id: <SESSION_ID>
x-platform: ANDROID
x-version: <APP_VERSION>GET https://mini-app.truevisions.co.th/th/tmn/sport?embed=1
tmn-access-token: <TMN_ACCESS_TOKEN>
x-device-id: <DEVICE_ID>
x-session-id: <SESSION_ID>
x-platform: ANDROID
x-version: <APP_VERSION>GET https://mini-app.truevisions.co.th/th/tmn/content/mOdBP4KN5vd3?embed=1
tmn-access-token: <TMN_ACCESS_TOKEN>
x-device-id: <DEVICE_ID>
x-session-id: <SESSION_ID>
x-platform: ANDROID
x-version: <APP_VERSION>GET https://mini-app.truevisions.co.th/th/tmn/play/mOdBP4KN5vd3?embed=1
tmn-access-token: <TMN_ACCESS_TOKEN>
x-device-id: <DEVICE_ID>
x-session-id: <SESSION_ID>
x-platform: ANDROID
x-version: <APP_VERSION>// Opens any mini-app page signed in: GET the page with your token headers.
// loadUrl sends the extra headers on the first request only, which is all
// sign-in needs; the page keeps the session after that.
fun openMiniApp(webView: WebView, path: String, token: String) {
webView.loadUrl(
"https://mini-app.truevisions.co.th/th/tmn" + path,
mapOf(
"tmn-access-token" to token,
"x-device-id" to deviceId,
"x-session-id" to sessionId,
"x-platform" to "ANDROID",
"x-version" to appVersion
)
)
}
openMiniApp(webView, "/sport?embed=1", token)
openMiniApp(webView, "/series?embed=1", token)
openMiniApp(webView, "/content/mOdBP4KN5vd3?embed=1", token)
openMiniApp(webView, "/play/mOdBP4KN5vd3?embed=1", token)// Opens any mini-app page signed in: GET the page with your token headers.
func openMiniApp(_ webView: WKWebView, path: String, token: String) {
var request = URLRequest(url: URL(string: "https://mini-app.truevisions.co.th/th/tmn" + path)!)
request.setValue(token, forHTTPHeaderField: "tmn-access-token")
request.setValue(deviceId, forHTTPHeaderField: "x-device-id")
request.setValue(sessionId, forHTTPHeaderField: "x-session-id")
request.setValue("iOS", forHTTPHeaderField: "x-platform")
request.setValue(appVersion, forHTTPHeaderField: "x-version")
webView.load(request)
}
openMiniApp(webView, path: "/sport?embed=1", token: token)
openMiniApp(webView, path: "/series?embed=1", token: token)
openMiniApp(webView, path: "/content/mOdBP4KN5vd3?embed=1", token: token)
openMiniApp(webView, path: "/play/mOdBP4KN5vd3?embed=1", token: token)<iframe name="tvs" allow="autoplay; fullscreen; encrypted-media" style="width:100%;height:100%;border:0"></iframe>
<form id="tvs-open" method="post" target="tvs" action="https://mini-app.truevisions.co.th/th/tmn/series?embed=1">
<input type="hidden" name="partner_token" value="<TMN_ACCESS_TOKEN>">
<input type="hidden" name="platform" value="WEB">
</form>
<script>document.getElementById("tvs-open").submit()</script>
<!-- Other pages: change the form action, e.g.
https://mini-app.truevisions.co.th/th/tmn/sport?embed=1
https://mini-app.truevisions.co.th/th/tmn/content/mOdBP4KN5vd3?embed=1 -->| Header | Example | Meaning |
|---|---|---|
x-device-id | <DEVICE_ID> | Stable device id you already report to TrueID. |
x-session-id | <SESSION_ID> | Your app session id (a UUID is generated when omitted). |
x-platform | ANDROID | ANDROID or iOS. Picks the AAA client id. |
x-version | <APP_VERSION> | Your app version, e.g. 9.12.0. |
If a page is opened without a token
The page sends the viewer to the TrueID login page (identity.trueid.net) and brings them back to the same page once they log in. That works, but it makes the viewer log in again inside your app, so always open pages with the token.
When sign-in fails
The WebView lands on /th/tmn/auth/error?code=…, a localised page with a Back to home button.
| Code | Meaning | What to do |
|---|---|---|
missing_credentials | No token found in the request. | Check the header name: tmn-access-token. |
aaa_10032 | AAA says the partner token is expired or invalid. | Refresh your token and open the page again. |
aaa_14229 | The account has no mobile number and cannot be linked. | Show your own guidance; retrying won't help. |
request_code | AAA could not be reached or refused the request. | Retry; contact us if it persists. |
exchange | The code could not be exchanged for a token. | Open the page again. |
invalid_state | The sign-in link expired (10 minutes) or was tampered with. | Open the page again. |
Testing
- Pre-production base URL:
https://mini-app.truevisions.co.th. It talks to TrueID pre-production (identity.trueid-preprod.net). - Pre-production TrueID accounts can be real accounts: purchases may charge real money. Use the test accounts from onboarding.
- In the WebView's network log the first request is your page URL with the token, then a
303back to the same URL with#at=…, which the page removes from the address bar at once.