WeChat Mini Programs Can't Identify a Phone. This Team Built the Closest Workable Substitute
Any login system inside WeChat Mini Programs hits the same wall: the platform deliberately withholds physical device identifiers, so reinstall-proof device recognition requires a compromise. A user-scoped feature hash merges same-model devices, changes across WeChat accounts, and offers no anonymization; teams adopting this pattern still need real-device testing because the official field docs diverge from what handsets return.
Inside WeChat's Mini Program sandbox there is no physical device identifier: no IMEI, no MAC, no IDFA, no Android ID, and a self-generated UUID vanishes when users clear Storage, which is also isolated per WeChat account and per Mini Program. One team facing a reinstall-resistant device-ID requirement ended up building a client-computed identifier that hashes openid together with platform, brand, model, CPU type, and memory tier into an `acf-v1_` field passed verbatim through the login chain.
Real-device testing shaped the field whitelist more than the official docs did. On four test machines, five discrepancies surfaced: memorySize returns numbers, not the documented string; Mac's CPU field is uppercase CPUType; `unknown` literals and empty values normalize to `-`; iOS `model` carries a marketing name that gets stripped; and deviceAbi was dropped for zero discrimination. The digest pipeline uses SHA-256 plus unpadded base64url, kept out of the main package because iOS 13's JSCore lacks BigInt.
The team drew hard lines around what the field can and cannot claim: it merges two same-model devices under one username, changes when a user switches WeChat accounts, and is not anonymization. Login reliability beats identifier coverage: every step has a 3-second cap with two attempts, fallback values use an `acf-v1-tmp_` prefix, and a shared lock keeps three concurrent wx.login call sites from consuming the same single-use code.
Client-side device identity inside a Mini Program tops out where the platform does: WeChat can't answer 'is this the same phone', so the team reworded the requirement to 'this WeChat user has logged in on such a device'; any product claiming reinstall-proof physical-device recognition in a Mini Program is overpromising.
Real-device testing beats official documentation for field reporting: the docs' types and coverage diverged in five places on four machines, and only a hands-on hardware pass caught them.
Including openid is a deliberate identity-versus-anonymity trade-off: it kills cross-account device association, so risk control stays on a separate vendor token, and the hash intentionally adds no anonymization because a backend holding openid can enumerate the small feature space.
The 6-second wait cap forced the team to abandon its own 'authentication doesn't wait on background tasks' convention; reviewers objected until the timeout and failure fallback were explained.
The project shipped a draft-status document to production, accepting that Windows and HarmonyOS remain untested, which keeps the algorithm honest about its own coverage.