SShortSingh.
Back to feed

How to Validate Telegram Login Widget Payloads Using PHP and Yii2

0
·1 views

A developer tutorial published on DEV Community outlines how to verify Telegram Login Widget authentication payloads in a PHP and Yii2 backend. When users log in via the Telegram widget, parameters including a hash signature are sent to the application's redirect URL and must be validated server-side. The guide explains constructing the data_check_string, deriving a secret key from the bot token using SHA-256, and comparing HMAC signatures with a timing-safe hash_equals() check. It also covers verifying that the auth_date timestamp falls within an acceptable freshness window, typically 86,400 seconds. Finally, the tutorial demonstrates binding the verified telegram_id to an existing or new user record within a Yii2 controller.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How Chinese Super Apps Work Architecturally — And Why Flutter Cannot Replicate Them

Chinese super apps like WeChat, Alipay, and Douyin are software platforms built on three layers: a native host shell, an embedded mini-program runtime, and third-party mini-programs that update without going through app stores. The key technical component is the embedded script runtime, which executes isolated third-party code using JavaScript engines rather than natively compiled frameworks. Apple's App Store Guideline 2.5.2 prohibits apps from downloading or executing new native code post-review, which is why Flutter's AOT-compiled Dart binaries cannot legally serve as a dynamic mini-program runtime on iOS. Each major Chinese super app has developed its own proprietary JS-based engine — such as WeChat's MINA framework with its dual-thread JSCore architecture — to work within these platform constraints. The article outlines four Flutter-compatible approaches for developers seeking to build multi-service apps, while clarifying what is and is not achievable within the Flutter ecosystem today.

0
ProgrammingDEV Community ·

Developer builds offline cold email scorer in single HTML file, no dependencies

A B2B sales writer frustrated by vague cold-email advice built a deterministic email scoring tool packed into a single 220-line HTML file with no frameworks, APIs, or external dependencies. The tool accepts a subject line and body, then returns a score out of 100 across eight measurable checks including subject length, spam phrases, word count, readability, and call-to-action detection. The developer deliberately avoided AI model calls to ensure identical inputs always produce identical outputs and to eliminate privacy concerns around real sales emails. Every scoring threshold — such as a subject line ceiling of 55 characters and a body word count sweet spot of 50 to 150 — was manually justified and documented rather than delegated to a black-box model. The project is publicly available on GitHub under an MIT license.

0
ProgrammingDEV Community ·

Splitting React layout components improves accessibility and cross-framework portability

A developer discovered that a React design-system layout component broke when migrated to a Next.js App Router project, because the component assumed it owned both persistent chrome and per-page content in a single composition. Next.js separates layout and page ownership across different lifecycle boundaries, making that assumption invalid. The accessibility relationships — particularly a skip link targeting a focusable page heading via a shared ID — silently broke alongside the composition model. The fix involved splitting the single layout into two explicit components: a shell owning the skip link and landmark, and a page content component owning the focusable heading. Making the accessibility contract explicit between components, rather than hiding it inside one monolithic unit, restored both portability and correct focus behaviour.

0
ProgrammingDEV Community ·

Designer finds AI accelerates UI/UX execution without replacing core design thinking

A UI/UX designer sharing on DEV Community reports that integrating AI tools into their workflow has significantly sped up the process from concept to tangible prototype. The designer follows a structured pipeline — from product requirements and user flows to wireframes, AI-assisted exploration, and testing — where AI aids ideation but not decision-making. Key design judgments, such as what to build, what to cut, and how to serve users, remain entirely the designer's responsibility. The designer notes that AI tools are improving rapidly each month, making it increasingly important to use them without sacrificing the reasoning behind design choices. The post concludes with an open question to the community about their own experiences using AI in design or development workflows.

How to Validate Telegram Login Widget Payloads Using PHP and Yii2 · ShortSingh