Engineering

Integrating ThaID: a practical authentication guide

ThaID gives your application a legally recognized digital identity check backed by DOPA. The protocol is straightforward on paper but has sharp edges in practice — here is the flow, the common pitfalls, and how we handle sessions afterward.

Rungwiroon K.

The verification flow

At a high level, your app redirects the user to authenticate with the ThaID app, the user approves, and you receive a verified identity assertion. Treat that assertion as a one-time proof of identity, not a standing credential — the moment of verification and your application session are two different things, and conflating them is the first mistake teams make.

Pitfalls at the edges

The unhappy paths cause most support tickets: the user cancels mid-flow, the app times out, or the same person verifies on a second device. Decide explicitly what each case means for your account model, and never assume the callback will always arrive. Idempotent handling of repeated callbacks saves you from creating duplicate accounts when the network retries.

Sessions after verification

Once identity is proven, mint your own session with its own lifetime and revocation. Store the minimum identity attributes you actually need rather than the full assertion, both to limit PDPA exposure and to keep your session store lean. Re-verification should be required for high-risk actions, not for every page load.