Migrating Telegram Mini App to MatchID
Telegram
Overview
MatchID provides a solution to run your Telegram Mini App independently on your website with little or no efforts, allowing you to leverage MatchID as an authentication and user management solution within your App.
Why Migrate?
The Telegram Mini App is a mini-program based on Telegram, designed to create and run applications within Telegram. However, due to its limitations, you may encounter the following issues:
- The Telegram Mini App cannot be used outside of Telegram ecosystem.
- The Telegram Mini App requires DApps to migrate to the TON ecosystem.
Migration Steps
- Integrate using our React SDK
- Code a simple login page and place a Login with MatchID button on it. Example is at LoginScreen.tsx
- Start by getting a login code
- Next launch MatchID Auth Telegram Mini App for user authentication
- Poll login status and then proceed with login when the user is back to your telegram mini app
- ⏳ Polling Timing
js
let attempts = 0;
const maxAttempts = 15; // ~30 seconds
const delayMs = 2000; // 2 seconds between checks
- This means:
- Total polling time = 15 × 2 seconds = 30 seconds
- If you believe your users may:
- Be on slow networks
- Use older/slower devices
- Switch context when verifying
- Then you can adjust maxAttempts and delayMs to be more lenient:
- Now fetch user authentication credentials
- Finally get user info and save them