Menu

Stop Client User Spoofing in React Telegram Mini Apps with Backend HMAC Check
📰

Stop Client User Spoofing in React Telegram Mini Apps with Backend HMAC Check

DEV Community: react·Serhii·about 1 hour ago
#5aobiHdt
#devtoreact#devto#dev#telegram#initdata
Reading 0:00
15s threshold

Building a Telegram Mini App inside React feels straightforward: Telegram provides a native JavaScript script, developers load it, pull the user object from window.Telegram.WebApp.initDataUnsafe.user , and render a custom storefront or checkout interface.

However, relying on initDataUnsafe for backend transactions opens a severe security vulnerability. The initDataUnsafe object is unverified front-end state. Anyone opening your Mini App in Telegram Desktop, a browser, or a custom webview can open Developer Tools or intercept network requests to override window.Telegram.WebApp.initDataUnsafe.user.id with any arbitrary user ID.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.