Authorization via TON Connect: where app sign-in breaks
Wallet sign-in looks like a simple exchange: the app forms a request, the wallet returns an address and signature, and the server issues a session.
It usually breaks not on cryptography, but at the junctions — when the TON Connect response arrives via a different channel than the interface expects.
A browser extension responds within the page, a mobile wallet — by returning via a link, and a browser built into a wallet — with no redirect at all.
An unhandled wallet response on any of these paths produces one symptom: the signature has already been made, but the user sees an authorization error and taps “connect wallet” again.
Session loss is the second quiet point. While the tab is open, the connection state lives in memory, but after a reload or returning from background on a phone it disappears, while on the server the session key is still valid.
Reconnecting the wallet to the app at that moment either hits an occupied session or breeds duplicate links.
A separate area is request signing: payload lifetime, domain binding, and address verification on the server. Partial verification produces false rejections during slow confirmation and acceptance of a signature issued for another app. Below we break down how these points are closed by design rather than by patches in the interface.
What Changes After Implementation: Sign-In Speed and Successful Session Rate
A carefully assembled sign-in via TON Connect removes intermediate steps: no need to come up with a password, wait for an email, and enter a code. Two actions remain — connect the wallet and sign the message. Authorization time stops depending on email delays and is measured in seconds, not minutes.
The main metric here is the successful sign-in rate. Each extra screen lost part of the audience, and the main drop-off was at confirmation: the user closed the wallet, returned to the wrong tab, or the signature did not match the expected address.
We handle returning to the app and an expired request explicitly — with a clear message and a retry, rather than an empty screen.
The class of failures itself also changes. Instead of a set of “email didn't arrive,” “code expired,” “password forgotten,” one predictable scenario remains — the user rejected the signature.
This is a deliberate action, not an infrastructure failure, so support stops handling repetitive tickets.
Session stability rests on server-side signature verification and access token lifetimes: the session is extended without re-confirmation in the wallet, revoked when the address is unlinked, and correctly survives a wallet account switch.
Sign-in becomes predictable: the successful attempt rate grows, and the number of access-related tickets falls.
Wallet Connection Methods: Comparison of Modes and Limitations
The connection mode determines not only how the user gets into the app, but also what has to be done for every significant operation: sign again or reuse a persistent session.
This affects the share of users who reach sign-in, the amount of logic on the interface side, and the number of failure points between the wallet and the backend.
In practice, the choice comes down to five scenarios — from a browser extension to a hybrid scheme where a mobile wallet backs up the desktop version. Below is a comparison by compatibility and limitations of the sign-in method.
| Option | When It Fits | Limitations |
|---|---|---|
| Browser extension | Desktop scenario, audience with an installed wallet | Does not work on smartphones, requires installing and updating the extension |
| Mobile wallet by code or link | Primary traffic from smartphones | Return to the app depends on the platform, some users are lost during the transition |
| Third-party intermediary service | Sign-in is needed for those who do not yet have a wallet | A trusted party appears, control over keys narrows |
| One-time signature verification | Confirming ownership of an address, signing in to an account | There is no persistent session — the signature is requested again for every action |
| Hybrid scheme | Mass product with different device types | Session revocation logic and error handling are noticeably more complex |
We separately design what usually surfaces already in production: behavior on access revocation, device change, and reconnection. A persistent session must end predictably, and one-time signature verification must not require extra confirmations where they are not needed.
Implementation Stages: From Flow Diagrams to Handover of Procedures
We start by breaking down scenarios: how the user signs in from a computer and from a phone, which roles are involved, and what data should end up in the session.
Based on the results, we fix the authorization scheme — from the wallet connection request to issuing the server session — and only after that move to code. We build the scheme on TON Connect because it is the standard for wallet connection, not a homemade key exchange.
- Sign-in scenario analysis. We gather real paths: a browser with a wallet extension, a mobile app, a QR-code transition. We separately discuss behavior when the user closed the confirmation window or connected with a different address.
- Authorization scheme. We describe the sequence of steps: connection request, payload formation, signing on the wallet side, server verification, session issuance, and linking the address to the account.
- Integration setup. We fill in the manifest, define the list of supported wallets, signature and session lifetimes, and the rules for handling rejection and reconnection.
- Test environment. We deploy an isolated environment with a test network to run sign-ins without affecting real wallets and production data.
- Verification order. We go through a set of cases: successful sign-in, signature rejection, reuse of the same signature, expired session, address change. We close each case with server-side verification, not only on the interface side.
- Solution handover. We provide procedures, flow diagrams, descriptions of access and logging, train the team, and support the first period of operation.
What the Team Retains: Configurations, Diagrams, and Access Procedures
The integration does not end with a working sign-in button: it is important that after acceptance the team retains artifacts by which any engineer can bring up the environment, investigate a ticket, and add a new sign-in method without reading the entire codebase.
We collect them during the work, not “write them later,” and hand them over along with the source code.
- Configured environments — test and production environments with descriptions of node addresses, connection variables, key storage locations, and rules for filling in the manifest file by which the wallet recognizes the app.
- Authorization flow diagrams — the path from clicking a button in the interface to session issuance: message formation, signature verification on the service side, linking the wallet address to the account, and handling re-entry.
- Role matrix — which employees read connection logs, who changes the list of supported wallets and domains, who revokes active sessions.
- Access policies — signed message and session lifetimes, key rotation procedure, actions in case of wallet compromise or owner change.
- Authorization documentation — signature requirements, a table of error codes and what the user sees at each step, domain restrictions.
- Verification set — signature and message reuse tests, signature rejection and connection loss scenarios, session revocation checks.
- Support procedure — what data to collect for a “sign-in fails” ticket, how to distinguish a wallet problem from a service problem, and within what time we respond.
We enter each item into the same repository as the code, with an owner marked, so that six months later changes in sign-in logic do not diverge from the documentation.
Case Study: How Wallet Sign-In Stopped Losing Users
Before: Sign-In Was Lost Midway
The project was a digital goods marketplace with wallet authorization.
Initially, sign-in was assembled on direct provider calls: the signature was verified on the client, the connection state lived in the tab's memory, and when confirmation was rejected the user returned to an empty screen and started over.
We analyzed the funnel using logs. Of those who clicked “Connect wallet,” 63% reached a confirmed session.
Every third visit was accompanied by a repeated sign-in attempt: people closed the wallet window when the network did not match, and the app did not report what exactly went wrong.
Restoring the session after a page reload required manually repeating the whole chain — an average of four actions in a row.
After: One Chain with Explicit States
We rebuilt TON Connect as the single point of entry: signature verification moved to the server, connection state is stored with binding to the session key, and each failure got its own screen — “wallet not installed,” “network does not match,” “signature rejected.” Returning from any failure leads to the same step, not the beginning of the scenario.
The share of completed sign-ins grew from 63% to 91%, and repeat attempts decreased almost threefold. The session is restored automatically after a reload — one user action instead of four, without re-confirmation in the wallet.
Support tickets about sign-in dropped to a few per week, and the integration case itself became a template for the client's other services.
How Does TON Connect Differ from Custom Message Signing?
Both approaches solve one task — proving to the app that the user owns the key. TON Connect is a ready-made wallet connection: the standard already describes the exchange, signing, and session lifecycle.
Custom signature verification means we assemble this entire exchange ourselves, from forming the request to parsing the response.
The difference shows not at the start, but over the long run.
| Criterion | TON Connect | Custom Message Signing |
|---|---|---|
| Wallet compatibility | A single standard — a new wallet connects without modifications | Each wallet requires a separate response parsing branch |
| Solution maintenance | Standard changes are handled by the community | We catch, test, and roll out new formats ourselves |
| Control | We work within the standard | Full control over the scenario and session data |
| Risks | Failure is partly shifted to the standard | Request replay, indefinite session, address substitution — on our side |
The most expensive part of custom authorization is not signature verification, but its environment: a one-time request identifier, domain binding, limited session lifetime, and access revocation.
A missed item turns into a class of vulnerabilities that can be reproduced without cracking keys — it is enough to replay a saved response.
That is why by default we go through TON Connect, and we take custom signature verification only where a scenario outside the standard is needed.
In this case, isolating the verification logic and a separate test environment for replay and substitution are a mandatory part of the work, not an option.
Questions Asked Before Starting Wallet Integration
Before starting TON Connect integration, technical doubts accumulate in the team, and almost all of them are about user behavior at the edge of the scenario. Below are answers to those that come up in every discussion: wallets, signing, session, and a second sign-in method.
What to do with wallets that are not supported?
We fix the list of supported wallets at the start and verify it by connecting. At sign-in we show only those that passed verification; to the rest we give clear text instead of a frozen button — the refusal looks predictable, not like “clicked and nothing happened.”
How is signature reuse prevented?
The signature is bound to a one-time value and a short lifetime; the server checks both conditions before issuing a session. A resubmitted request is rejected — an intercepted message will not become a second sign-in.
How long does the session live, and what happens on connection loss?
The session is extended based on activity and closed on inactivity. On a disconnect, the user returns to the same context rather than starting sign-in over — this matters for long forms and transfer confirmations.
Can a second sign-in method be added?
Yes: wallet sign-in is not the only path; we place a familiar method next to it (email or phone), and both lead to one profile. We fix the priority of methods at the design stage so the screen does not have to be rewritten later.
Let's Discuss the Task: We'll Analyze Scenarios and Come Back with a Plan
To come back with an integration estimate rather than general wording, we need input data about your product. Even rough answers shorten the time to prepare a work plan and remove uncertainty at the start of the project. Some things may be missing — we will clarify some together.
- Sign-in scenarios: what roles exist in the product and what each should do — only authorize, confirm wallet ownership, sign an operation, or link an address to an existing account.
- Current sign-in scheme: what works now — email, external provider, custom session — and how TON Connect sign-in should coexist with it.
- Environments: where the feature will live — test environment, staging, main domain — and whether separate addresses are needed for mobile builds.
- Wallets: which apps users come with most often and which require separate behavior checks on connection and signature rejection.
- Restrictions: requirements for session storage, token lifetimes, access rules within the team, external regulatory conditions.
- Expected metrics: what share of users needs to be moved to the new sign-in, target connection time, and by which metrics you will validate the result after launch.
- Materials: repository access, current authorization diagram, description of the exchange with the backend, test accounts, examples of ticket logs.
Describe the task in free form and attach what you have. We will analyze the scenarios, separately discuss risks with wallet access, and come back with an integration estimate and a staged work plan — with points where you can check the intermediate result.







